Running Node as a service with PM2 - connection refused

一曲冷凌霜 提交于 2020-04-11 03:11:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!