node.js - 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
解决方案
推荐阅读
- excel - 使用 VBA 和 Selenium WebDriver 登录网站
- python - 我的一个循环不起作用,有人可以给我一个原因吗?
- java - 输出问题,if语句在不应该执行的时候被执行
- reactjs - 如何在反应样式的组件中使用材质颜色?
- javascript - React 图像在本地加载,但不在 AWS Amplify 上
- java - 我如何在 jeroo 做一个盒子实验室?
- excel - 将缩放视图自动调整到表格中的活动/可见单元格?
- c++ - 如何将程序输出重定向为其输入
- sql-server - Invoke-ASCmd 不是 Powershell 模块 sqlserver(版本 21.1.18228)中的 cmdlet
- javascript - Javascript:在代码中使用字符串作为变量名