502 Bad Gateway when following Django Nginx Ubuntu 16.04 guide

November 18, 2016 75 views
Django PostgreSQL Python Python Frameworks Ubuntu 16.04

I'm following this guide. The development methods for serving my Django app work (using python manage.py runserver and gunicorn --bind 0.0.0.0:8000 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 mysite.com/sub/, since there is a website currently being served on the root domain.

Your help is greatly appreciated,

Nathan

Be the first one to answer this question.