使用nginx生成node.js服务器

时间:2013-11-15 22:35:36

标签: nginx wintersmith

所以这对我来说是新的。我在端口3000上的服务器上运行了node.js应用程序。我有一个nginx代理:

upstream websli_nodejs_app_2 {
    server 127.0.0.1:3000;
}

# this is the dynamic websli server
server {
listen 80;
server_name test.ch;
#root /var/www/websli/public;


# pass the request to the node.js server with the correct headers and much more can be added, see nginx config options
location / {
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_set_header X-NginX-Proxy true;

  proxy_pass http://websli_nodejs_app_2/;
  proxy_redirect off;
  }
}

这就像一个魅力。现在我正在产卵(至少我相信这就是所谓的)。更多节点应用。这就是Wintersmith到位的地方:我正在运行wintersmith预览

在我的localhost上将导致localhost:8000上的另一个node.js服务器。当我在浏览器中转到localhost:8000时,我得到了预期的结果,但是在我的localhost上我没有设置nginx代理。

问题:

现在我在nginx的生产设置上,我有点卡住,因为我显然无法访问localhost:8000

我试图添加另一个上游服务器,但这并没有真正解决。然后我也尝试在dev.test.ch:8000之类的东西上产生,但这会导致类似错误的内容听EADDRNOTAVAIL

我在寻找什么

目标是从我的主node.js服务器中启动另一台服务器,并使其可以从浏览器访问。任何意见都受到欢迎。

0 个答案:

没有答案