1

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 0.0.0.0:8001. My Nginx configuration has the following at the top of my only config in sites-enabled:

upstream django_test {
    server 127.0.0.1:8001;
}

...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 127.0.0.1 from the server I still get the 502 bad gateway.

Does anyone know what could be happening here?

benwad
  • 255
  • 2
  • 12

1 Answers1

0

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.

SebasSBM
  • 143
  • 1
  • 10