问题
I am following this tutorial for setting up a node project on a Digital Ocean Ubuntu distribution. systemctl status pm2
shows the service is online:
App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching
server │ 1 │ fork │ 19999 │ online │ 0 │ 0s │ 21.219 MB │ disabled │
However I get a connection refused error when I attempt to navigate to the domain. The application starts fine on port 5000 if I run it with npm start. I have Nginx installed and configured as follows:
server {
listen 80;
server_name <mysite.com>;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Node version is v6.3.0 and pm2 version is 1.1.3.
来源:https://stackoverflow.com/questions/38277557/running-node-as-a-service-with-pm2-connection-refused