Question

gunicorn not starting

hello everyone.

not sure why but i get a 502 gateway nginx 1.10 error when i go to my ip. i just uploaded my files to home/django/django_project. i am guessing the problem is from gunicorn because nothing happens when i type the command service gunicorn restart via putty in the commandline

here is my nginx file

[error] 26244#26244: *674 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client: 110.170.170.250, server: _, request: “HEAD http://67.207.87.22:80/PMA2014/ HTTP/1.1”, upstream: “http://unix:/home/django/gunicorn.socket:/PMA2014/”, host: “67.207.87.22” 2017/07/20 12:03:57 [error] 26244#26244: *674 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client: 110.170.170.250, server: _, request: “HEAD http://67.207.87.22:80/PMA2015/ HTTP/1.1”, upstream: “http://unix:/home/django/gunicorn.socket:/PMA2015/”, host: “67.207.87.22” 2017/07/20 12:03:57 [error] 26244#26244: *674 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client: 110.170.170.250, server: _, request: “HEAD http://67.207.87.22:80/PMA2016/ HTTP/1.1”, upstream: “http://unix:/home/django/gunicorn.socket:/PMA2016/”, host: “67.207.87.22” 2017/07/20 12:03:57 [error] 26244#26244: *674 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client: 110.170.170.250, server: _, request: “HEAD http://67.207.87.22:80/PMA2017/ HTTP/1.1”, upstream: “http://unix:/home/django/gunicorn.socket:/PMA2017/”, host: “67.207.87.22” 2017/07/20 12:03:58 [error] 26244#26244: *674 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client:

Would appreciate it if someone could point me to the right direction. Thanks


Submit an answer


This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Accepted Answer

Hi @iknwosu3

Correct, the problem is somewhere in Gunicorn, so we’re not going to get much from Nginx. Make sure you’ve activated error logging: http://docs.gunicorn.org/en/stable/settings.html#errorlog Depending on your installation, sometimes it’s already enabled and you’ll find the log somewhere in your app directory or /var/log/gunicorn.log

@iknwosu3

What’s the value of ExecStart in /etc/systemd/system/gunicorn.service?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel