nginx多个端口用于反向代理

时间:2013-11-12 18:08:34

标签: node.js ubuntu nginx reverse-proxy

我让nginx使用反向代理来查找node.js应用程序 - 基本上我正在侦听端口80并为端口3000上运行的node.js内容提供服务。

现在,在同一个域上,对于同一个nginx实例,我想设置另一个反向代理,但我的配置似乎不起作用。

server {
    listen 80;

    server_name test;

    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;
    }
}
server {
    listen 8080;

    server_name test2;

    location / {
        proxy_pass http://localhost:3001;
        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端口 - > 3000逆转,但另外我想添加8080 - >混合3001。有什么建议吗?

0 个答案:

没有答案
相关问题