域名后需要的端口号

时间:2015-10-23 14:56:20

标签: node.js nginx

我已经按照数字海洋教程将我的node.js应用程序部署到VPS上。一切正常,但不是从myDomain.com到达应用程序,它只能通过myDomain.com:3700获得。 myDomain.com仅显示“成功!虚拟主机已设置!”

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

奇怪的是,如果我将其更改为:

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

并输入sudo nginx -s reload,没有任何变化。

在我的节点应用中,我有:

...
var port = 3700;
...

0 个答案:

没有答案