[Fixed]-502 Bad Gateway nginx/1.1.19 on django

1👍

Error 502 Bad Gateway means that the NGINX server used to access your site couldn’t communicate properly with the upstream server (your application server).

This can mean that either or both of your NGINX server and your Django Application server are configured incorrectly.

Double-check the configuration of your NGINX server to check it’s proxying to the correct domain/address of your application server and that it is otherwise configured correctly.

If you’re sure this isn’t the issue then check the configuration of your application server. Are you able to connect directly to the application server’s address? If you are able to log in to the server running the application, you can try localhost:<port> using your app’s port number to connect directly. You can try it with curl to see what response code you get back.

Leave a comment