Russj
Russj

Reputation: 727

Nginx proxy_pass doesn't work on port 80

I am using a DigitalOcean VPS hosting a meteor app. I don't have a domain name yet, so just use the plain IP address. When I set below config and use myipaddress:3000 and myipaddress:8080, both of them worked well; but if I change the 8080 to 80, only myipaddress:3000 works. Using only myipaddress or myipaddress:80 will show "Welcome to nginx on Debian!" message. (I use Ubuntu 14.04 on the VPS).

server {
    listen 8080;
    server_name default;

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

Can not figure out why can't use port 80.

---- Solved this problem --------

I commented out the "listen 80 default_server" in the /etc/nginx/sites-enabled/default" file, then my config at "/etc/nginx/conf.d/mysite.conf" works on port 80.

Upvotes: 4

Views: 12538

Answers (1)

ThrowsException
ThrowsException

Reputation: 2636

You probably still have the default.conf still in the directory that nginx is using to serve up the sites. either that or check in nginx.conf. Somewhere there is a server setup already using 80 that is being served first.

Upvotes: 11

Related Questions