Nginx proxy_pass 无法在端口 80 上运行

Nginx proxy_pass doesn't work on port 80

我正在使用托管流星应用程序的 DigitalOcean VPS。我还没有域名,所以只使用普通 IP 地址。当我设置下面的配置并使用 myipaddress:3000myipaddress:8080 时,它们都运行良好;但如果我将 8080 更改为 80,则只有 myipaddress:3000 有效。仅使用 myipaddressmyipaddress:80 将显示 "Welcome to nginx on Debian!" 消息。 (我在 VPS 上使用 Ubuntu 14.04)。

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;
    }
} 

无法弄清楚为什么不能使用端口 80。

---- 解决了这个问题--------

我在 /etc/nginx/sites-enabled/default" 文件中注释掉了 "listen 80 default_server",然后我在 "/etc/nginx/conf.d/mysite.conf" 的配置在端口 80 上工作。

您可能还在 nginx 用来提供站点的目录中还有 default.conf。或者检查 nginx.conf。某处有一个服务器设置已经使用 80,它首先被提供。