使用nginx生成node.js服务器

使用nginx生成node.js服务器,nginx,wintersmith,Nginx,Wintersmith,所以这对我来说是新事物。我有一个node.js应用程序在我的服务器上运行,端口3000。我有一个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 t

所以这对我来说是新事物。我有一个node.js应用程序在我的服务器上运行,端口3000。我有一个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;
  }
}
这很有魅力。现在我正在产卵(至少我相信这就是它的名字)。更多节点应用程序。这就是温特史密斯的位置:我正在运行温特史密斯预览

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

问题:

现在在使用nginx进行生产设置时,我有点卡住了,因为我显然无法访问localhost:8000

我曾尝试添加另一个上游服务器,但实际上没有成功。然后,我还尝试生成类似dev.test.ch:8000的代码,但这会导致类似error listen EADDRNOTAVAIL的代码

我在找什么


目标是从main node.js服务器内部启动另一台服务器,并使其可以通过浏览器访问。非常欢迎任何输入。

使用wintersmith,您可以构建网站并将其上传到服务器,作为静态文件使用,无需在那里运行NodeJ。或者有什么我不明白的吗?是的,我在服务器上构建站点有点晚了,但是为什么不在服务器上构建站点,但仍然作为静态文件使用呢?配置
config.json
,使其输出到nginx可以服务的构建文件夹,但我希望使用预览服务器,这样更改就不会自动部署到生产中。。。但这个项目很老了。无论如何,谢谢你的评论。