首页 > 解决方案 > Elastic beanstalk 应用程序未连接到 Nginix

问题描述

成功部署后在日志中遇到此错误

----------------------------------------
/var/log/nginx/error.log
----------------------------------------
2020/10/23 07:41:02 [error] 4697#0: *412 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.33.154, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "172.31.17.64"

这是我的 package.json 脚本

 "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node ./bin/www",
    "dev": "nodemon --exec 'node ./bin/www'",
    "abc": "nodemon ../script.js"
  },

bin文件看起来像这样

常量端口 = normalizePort(process.env.PORT || "8080");

此日志显示服务器成功运行

----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Oct 23 08:39:50 ip-172-31-17-64 web: init cron
Oct 23 08:39:51 ip-172-31-17-64 web: web server listening on port 8081
Oct 23 08:39:51 ip-172-31-17-64 web: you are connected to database

标签: node.jsamazon-web-servicesamazon-elastic-beanstalk

解决方案


推荐阅读