I'm trying to get my server back online after an upgrade, and I can no longer seem to get Nginx to direct calls to Gunicorn - every request I send to the site gets back a 502 Bad Gateway. I have gunicorn_django running on port 8001 (as I can see from ps aux | grep gunicorn - the commands for the two workers have the argument -b My Nginx configuration has the following at the top of my only config in sites-enabled:

upstream django_test {

...so it should be directing requests to there. Nothing has changed about this config file since the upgrade.

When I visit mysite.com/robots.txt in my browser, it returns the robots.txt that I've defined in my sites-enabled config, so that file is definitely getting loaded. Furthermore when I run curl from the server I still get the 502 bad gateway.

Does anyone know what could be happening here?


I would check the configuration of the virtualhost in /etc/nginx/sites-available and the corresponding symlink in /etc/nginx/sites-enabled.

Also check out the configuration of /bin/gunicorn-start and make sure the parameters match your setup.

There is more comprehensive information about configuring django with nginx and gunicorn following this link.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.