Nginx 502 on Elastic Beanstalk (Node.js) since at least yesterday

0

I am deploying nestjs apps on the Elastic Beanstalk (node.js) platform since yesterday and most of the times it results in a 502 error from nginx on trying to access the app. I don't do any proxy configuration for elastic beanstalk when configuring the environment. It just choses nginx by default. On setting up cloudwatch logs I can see nginx erroring out with messages like these:

2024/04/04 10:41:53 [error] 11066#11066: *7 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "my-domain.random-stuff.ap-south-1.elasticbeanstalk.com"

Edit: I mentioned this has happened since yesterday because I was able to deploy stuff just fine 2 days before that. Also this may be relevant to the post made a few days ago on "upload and deploy" being blocked by some IMDS related settings.

Keshav
已提问 1 个月前158 查看次数
2 回答
0

Hello.

Looking at the log, it seems that it is proxying to "http://127.0.0.1:3000/".
I believe that the problem is caused by not being able to access "http://127.0.0.1:3000/".
What kind of service is running on "http://127.0.0.1:3000/"?

profile picture
专家
已回答 1 个月前
profile picture
专家
已审核 1 个月前
profile picture
专家
已审核 1 个月前
0

Double-check your NestJS code to ensure it's configured to listen on port 3000. If not, update the code to use the correct port Log into your environment and use commands like ps aux | grep node to see if your Node.js process is running. In your EC2 console, examine the security group assigned to your Elastic Beanstalk instances.

If possible, temporarily create a very basic Node.js app (basic HTTP server) and deploy it on your Elastic Beanstalk environment. If this works, it helps isolate whether the issue is with your NestJS app or the Beanstalk configuration.

profile picture
专家
已回答 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则