502 Bad Gateway Ngnix & Gunicorn

  • Posted on January 20, 2014
  • ismailAsked by ismail

Hey guys,

I followed these: intrstuctions to get my Django project up and running on my Droplet.

Problem is I’m getting a 502 Bad Gateway Error for some strange reason.

Has anyone stumbled upon the same issue? All help is appreciated.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You can pass <code>–log-file</code> to gunicorn when you launch it to specify where the log file gets stored. Any output there would be helpful in figuring this out. <br> <br>In your file have you set DEBUG to False? If so, remember that you need to add your IP to ALLOWED_HOSTS.

I had a similar problem (502) after creating a new folder as an alternative to the out-of-the-box django_project.
I saw in /var/log/upstart/gunicorn.log that it was getting a permission error on /home/django.

I fixed it by …

$ cd /home
$ chown -R django:django django

I had the same and just had to restart gunicorn with service supervisor restart

Hope that helps.