简体   繁体   English

Adonis - Elastic BeanStalk 上的 502 错误网关

[英]Adonis - 502 Bad Gateway on Elastic BeanStalk

I am trying to deploy an AdonisJS app on Elastic Beanstalk.我正在尝试在 Elastic Beanstalk 上部署 AdonisJS 应用程序。 I have followed several tutorials to do so but I am getting 502 Bad Gateway:(我已经按照几个教程这样做,但我得到 502 Bad Gateway:(

I have set PORT env variable to 8081 from the Configuration portal as suggested in all the tutorials out there.按照所有教程中的建议,我已从配置门户将PORT env 变量设置为 8081。

----------------------------------------
/var/log/nginx/error.log
----------------------------------------
2020/12/28 19:54:52 [error] 5218#0: *266 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.xxx.xx, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "172.xx.xx.x"
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Dec 28 20:06:36 ip-xxx-31-30-5 web: > adonis-api-app@4.1.0 start /var/app/current
Dec 28 20:06:36 ip-xxx-31-30-5 web: > node server.js
Dec 28 20:06:37 ip-xxx-31-30-5 web: #033[32minfo#033[39m: serving app on http://xxxxx-api-staging.us-west-2.elasticbeanstalk.com:8081
Dec 28 20:06:37 ip-xxx-31-30-5 web: events.js:291
Dec 28 20:06:37 ip-xxx-31-30-5 web: throw er; // Unhandled 'error' event
Dec 28 20:06:37 ip-xxx-31-30-5 web: ^
Dec 28 20:06:37 ip-xxx-31-30-5 web: Error: listen EADDRNOTAVAIL: address not available 44.242.xx.xx:8081
Dec 28 20:06:37 ip-xxx-31-30-5 web: at Server.setupListenHandle [as _listen2] (net.js:1300:21)
Dec 28 20:06:37 ip-xxx-31-30-5 web: at listenInCluster (net.js:1365:12)
Dec 28 20:06:37 ip-xxx-31-30-5 web: at GetAddrInfoReqWrap.doListen [as callback] (net.js:1502:7)
Dec 28 20:06:37 ip-xxx-31-30-5 web: at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:68:8)
Dec 28 20:06:37 ip-xxx-31-30-5 web: Emitted 'error' event on Server instance at:
Dec 28 20:06:37 ip-xxx-31-30-5 web: at emitErrorNT (net.js:1344:8)
Dec 28 20:06:37 ip-xxx-31-30-5 web: at processTicksAndRejections (internal/process/task_queues.js:84:21) {
Dec 28 20:06:37 ip-xxx-31-30-5 web: code: 'EADDRNOTAVAIL',
Dec 28 20:06:37 ip-xxx-31-30-5 web: errno: 'EADDRNOTAVAIL',
Dec 28 20:06:37 ip-xxx-31-30-5 web: syscall: 'listen',
Dec 28 20:06:37 ip-xxx-31-30-5 web: address: '44.242.xx.xx',
Dec 28 20:06:37 ip-xxx-31-30-5 web: port: 8081
Dec 28 20:06:37 ip-xxx-31-30-5 web: }
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! code ELIFECYCLE
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! errno 1
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! adonis-api-app@4.1.0 start: `node server.js`
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! Exit status 1
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR!
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! Failed at the adonis-api-app@4.1.0 start script.
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! A complete log of this run can be found in:
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR!     /home/webapp/.npm/_logs/2020-12-28T20_06_37_082Z-debug.log

Please help as its getting really frustrating now:(请帮忙,因为它现在变得非常令人沮丧:(

Thank you谢谢

Use 0.0.0.0 as HOST variable.使用0.0.0.0作为HOST变量。

The error occured because the application is not accessible.发生错误是因为无法访问应用程序。 Set HOST=0.0.0.0 to make the server listen on all interfaces.设置HOST=0.0.0.0使服务器监听所有接口。

You can see more details about 0.0.0.0 here: What is the difference between 0.0.0.0, 127.0.0.1 and localhost?您可以在此处查看有关0.0.0.0的更多详细信息: 0.0.0.0、127.0.0.1 和 localhost 有什么区别?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ExpressJS - Elastic Beanstalk 502 错误网关 - ExpressJS - Elastic Beanstalk 502 Bad Gateway 部署后 AWS 弹性 beanstalk Express 服务 502 Bad Gateway - AWS elastic beanstalk Express service 502 Bad Gateway after deployment Node.js和Docker- Elastic Beanstalk 502错误网关 - Node.js and Docker- Elastic Beanstalk 502 Bad Gateway 502 Bad Gateway在Elastic Beanstalk上部署Express Generator模板 - 502 Bad Gateway Deploying Express Generator Template on Elastic Beanstalk Nodejs 502 Bad Gateway在Elastic Beanstalk AWS上部署Express - Nodejs 502 Bad Gateway Deploying Express on Elastic Beanstalk AWS 弹性beantalk上的node.js:Firefox 502错误网关 - node.js on elastic beanstalk: firefox 502 bad gateway Elastic Beanstalk Nginx代理抛出502 Bad Gateway - Elastic Beanstalk nginx proxy throwing 502 Bad Gateway AWS Elastic Beanstalk / NodeJS / Nginx错误:不断收到502错误的网关 - AWS Elastic Beanstalk / NodeJS / Nginx Error: Keep getting 502 bad gateway 尽管CORS配置正确,但CORS 502 Bad Gateway,AWS Elastic Beanstalk Node.js服务器 - CORS 502 Bad Gateway, AWS Elastic Beanstalk Node.js server, despite proper CORS configuration 将Node.js页面部署到AWS Elastic Beanstalk之后,出现“ hell.php”错误和“ 502 Bad Gateway”错误 - Getting “hell.php” error and “502 Bad Gateway” error after deploying Node.js page to AWS Elastic Beanstalk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM