[Fixed]-Bad Gateway 502 Error with Django, Gunicorn and Nginx

1👍

This is due to lack of understanding about Nginx. I added www.mydomain.com in Nginx but I have habit of typing domain name without www in browser. I simply added “mydomain.com” and “www.mydomain.com”. So now both working without error. For others to follow if you have all the settings correct and still getting 502 that means the address you are looking for is not listed in Nginx. It could be one of the reason. Thanks for help though guys.

0👍

‘Bad Gateway’ indicates that Nginx is having trouble connecting the the Gunicorn process.

  1. Double check that the service that starts Gunicorn (the one defined by the upstart script you posted) is actually running
  2. What happens when you do curl http://127.0.0.1:9500/? Do you get a response from Gunicorn?

Leave a comment