1

I am deploying a django webapp on digitalocean and I am using Nginx and Gunicorn.

And when I open my url, it shows 502 bad gateway.

In the nginx_errors.log, I find the following error message:

[error] 12229#0: *1 connect() to unix:/home/demo/webapps/hello/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 123.45.6.78, server: demohello.com, request: "GET / HTTP/1.1", upstream: "http://unix:/home/demo/webapps/hello/run/gunicorn.sock:/", host: "demohello.com"

Is it because my nginx configuration is wrong? How to fix it?

Wei Xu
  • 1,629
  • 2
  • 19
  • 31

1 Answers1

0

You need to set the configurations for gunicorn correctly which is in /etc/init/gunicorn.conf.

Be careful with:

  • --name=django_project \
  • --pythonpath=django_project \
  • django_project.wsgi:application
Kikacaty
  • 1
  • 1