getting 502 bad gateway errors every time I turn on ec2 instance

0

I am currently building a web application on an ec2 instance. All of the code is stored within the server. When I type in the ec2 instance's ip address (35.167.110.26), I get a 502 bad gateway error. Although the server itself may have turned on, I still get a 502 bad gateway error because the code relies on a python import called flask. To enable flask, I have to manually type in "sudo service nginx restart" and "sudo service gunicorn3" restart within the /etc/nginx/sites-available directory. Once I type in those commands, the website works. Is there a way that I can enable these commands to run automatically every time I turn on the ec2 instance?

질문됨 2년 전1357회 조회
2개 답변
2

Use User-data to introduce the interested commands at launch. The following link should help: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

profile pictureAWS
Sudhi_B
답변함 2년 전
1

Hello,

You can use the following commands to add nginx and gunicorn3 to start up:

sudo systemctl enable nginx
sudo systemctl enable gunicorn3
profile pictureAWS
전문가
Chris_G
답변함 2년 전

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

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

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

관련 콘텐츠