Simple Node.js app gets 502 Bad Gateway

0

Hello I push a simple Node.js app that should return index.html on the main domain and listens API on main domain/api

Repo locates on Github and I tested it locally - everything works fine

I also checked inbound rules and there is presented a rule for 80 port Enter image description here

What would be a reason of 502 error ?

질문됨 일 년 전1680회 조회
2개 답변
0
수락된 답변

Aws Elastic Beanstalk does not allow running your Node.js app directly on the port 80.

I have solved my issue by adding Beanstalk config file to the project root: .ebextensions/app.config

option_settings:
  aws:elasticbeanstalk:application:environment:
    PORT: "8080"

And re-config my Node.js app to port 8080.

Now that is working inn the next way: I open app URL in browser -> Nginx gets request on port 80 and send in to myApp on 8080

P.S. Also need to add an inbound rule for port 8080;

답변함 일 년 전
0

What steps did you take to deploy?
When compressing files, did you select and compress the files you needed as described in the following blog?
https://dev.classmethod.jp/articles/nodejs-application-deployment-on-elastic-beanstalk/

profile picture
전문가
답변함 일 년 전
  • I use CodePipeline configured on main branch my Github repo. No manually deploy

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

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

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

관련 콘텐츠