502 Bad Gateway when following Django Nginx Ubuntu 16.04 guide

I’m following this guide. The development methods for serving my Django app work (using python runserver and gunicorn --bind myproject.wsgi:application), but when I set up the systemd and Nginx configuration files, I just get a 502 Nginx error page. I believe that Nginx is supposed to create the relevant .sock file at some point, but I don’t see one in my project directory.

Ultimately, I would actually like my Django app to be served on a subdirectory of the domain, like, since there is a website currently being served on the root domain.

Your help is greatly appreciated,



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

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.

stuck here too…really annoying

I have have exactly the same problem as well. A little help with be really appreciated.