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.

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
전문가
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전
profile picture
전문가
검토됨 한 달 전
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
전문가
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠