-1

I have followed along a digital ocean tutorial to deploy my node.js app onto VPS. Everything is working, but instead of reaching the app from myDomain.com, it's only available through myDomain.com:3700. myDomain.com only shows "Success! Virtual host is set up!"

/etc/nginx.sites-available/default:

server {
    listen 3700;

server_name myDomain.com;

location / {
    proxy_pass http://127.0.0.1;
    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;
    }
  }

Oddly, if I change it to:

server {
    listen 80;

server_name myDomain.com;

location / {
    proxy_pass http://127.0.0.1:3700;
    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;
    }
}

and enter sudo nginx -s reload, nothing changes.

in my node app, I have:

...
var port = 3700;
...
Cameron Sima
  • 107
  • 2
  • Have you tried changing your apps port variable to 80 instead of 3700 to match your nginx config? – Snow Oct 23 '15 at 20:39
  • You may need to restart nginx after changing the set of ports that are being listened on. – womble Oct 24 '15 at 06:41

1 Answers1

0

The message about the successful setup you are getting is from Apache web server, which is already running on port 80. Nginx is actually failing to bind to port 80 in your case.

I'm not exactly sure how you're setting up node.js and if Apache is supposed to play a role, but you have to either remove apache2 if it's not needed or reconfigure it to run on a different port.

Sašo
  • 1,494
  • 2
  • 10
  • 14