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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南