Node.js 用于NodeJ中多个端口的ElasticBeanStalk NGinx配置

Node.js 用于NodeJ中多个端口的ElasticBeanStalk NGinx配置,node.js,nginx,amazon-elastic-beanstalk,elastic-load-balancer,Node.js,Nginx,Amazon Elastic Beanstalk,Elastic Load Balancer,我将我的节点托管在ElastiCbean Stack环境中。 它使用默认配置和默认端口。 现在我计划打开另一个端口,并收听来自Nodejs应用程序的端口。这是在多端口中打开节点的一种方式 我已经完成了nodejs的编码部分,但我不确定nginx是否会改变以使其能够监听多个端口。 有人能给我解释一下吗?我只为配置了nginx,但本质上您需要配置server指令以包含您想要侦听的其他端口,例如: server { # listen for the extra the port the load

我将我的节点托管在ElastiCbean Stack环境中。 它使用默认配置和默认端口。 现在我计划打开另一个端口,并收听来自Nodejs应用程序的端口。这是在多端口中打开节点的一种方式

我已经完成了nodejs的编码部分,但我不确定nginx是否会改变以使其能够监听多个端口。
有人能给我解释一下吗?

我只为配置了nginx,但本质上您需要配置
server
指令以包含您想要侦听的其他端口,例如:

server {
  # listen for the extra the port the load balancer is forwarding to
  listen        88;
  access_log    /var/log/nginx/access.log main;

  client_header_timeout 60;
  client_body_timeout   60;
  keepalive_timeout     60;
  gzip                  off;
  gzip_comp_level       4;

  location / {
    # forward to the actual port the application runs on
    proxy_pass          http://127.0.0.1:8888;
    proxy_http_version  1.1;

    proxy_set_header    Connection          $connection_upgrade;
    proxy_set_header    Upgrade             $http_upgrade;
    proxy_set_header    Host                $host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
  }
}
因此,我建议您在Nodejs EB服务器上使用ssh,搜索nginx配置目录,查找
nginx
conf.d
文件夹,或
一个
nginx.conf
文件。当您找到它时,上面的
server
指令应该允许对nginx而言的多个端口进行访问

它没有像javaenv那样的
includes
,您必须使用自定义配置:谢谢,我稍微概括了一下我的答案