Skip to content Skip to sidebar Skip to footer

Nginx Flask Aws 502 Bad Gateway

My server is running great yesterday but now it returned a 502 error, how could this happen? In my access.log shows: [24/Aug/2016:07:40:29 +0000] 'GET /ad/image/414 HTTP/1.1' 502 5

Solution 1:

The HTTP status code 502 normally means that the application server Nginx is proxying to is not running. As this is a Flask app I presume this is something like Gunicorn or uwsgi. Check to see if that is running.

I normally use something like Supervisor to ensure that the application server gets restarted automatically if it goes down.

Solution 2:

It usually happens when the service isn't running.

So I'd bet your flask application or wsgi isn't running.

Solution 3:

I believe that gunicorn is not running on your system. Check the status of gunicorn process, and if it is not runningm start the process

Solution 4:

Looking at your error it mentions 123.49.616.74, server: app.example.com.au, I think within your configuration you have mentioned the IP address of your server. Replace that with your local IP i.e 127.0.0.1.

Since you are making the request as 127.0.0.1 in your browser and host specified in the Nginx configuration is: "app.example.com.au". Due to this connection will be refused by the server.

Post a Comment for "Nginx Flask Aws 502 Bad Gateway"