简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM