代码之家  ›  专栏  ›  技术社区  ›  chrisTina

Nginx不将流量路由到AWS ElasticBeanstalk中的Node js服务器

  •  0
  • chrisTina  · 技术社区  · 5 年前

    使用 ElasticBeanstalk 以部署NodeJS web应用程序。我有 Nginx 配置文件如下:

    events {}
    http {
      server { # simple reverse-proxy
        listen       80;
        # pass requests for dynamic content
        location / {
          proxy_pass      http://localhost:5000;
        }
      }
    }
    

    我让节点服务器从端口启动 5000 .

    我看到了 Nginx 开始似乎也不错:

    2021/08/25 16:16:28.573953 [INFO] Executing instruction: start proxy with new configuration
    2021/08/25 16:16:28.573976 [INFO] Running command /bin/sh -c /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf
    2021/08/25 16:16:28.678857 [INFO] Running command /bin/sh -c cp -rp /var/proxy/staging/nginx/* /etc/nginx
    2021/08/25 16:16:28.698889 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
    2021/08/25 16:16:28.717393 [INFO] Running command /bin/sh -c systemctl daemon-reload
    2021/08/25 16:16:28.824685 [INFO] Running command /bin/sh -c systemctl reset-failed
    2021/08/25 16:16:28.829180 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
    2021/08/25 16:16:28.834724 [INFO] Running command /bin/sh -c systemctl is-active nginx.service
    2021/08/25 16:16:28.838286 [INFO] Running command /bin/sh -c systemctl start nginx.service
    

    但是当我点击 弹性Beanstalk 链接,我看到它转到了带有标题的默认AWS Nginx页面 Welcome to nginx on Amazon Linux!

    我在配置中遗漏了什么吗?

    0 回复  |  直到 5 年前