gunicorn - failure: Connection reset by peer

Deploying a django project to my droplet I encounter a gunicorn issue:

curl --unix-socket /run/gunicorn.sock localhost
curl: (56) Recv failure: Connection reset by peer

This error is raised when by the command: curl --unix-socket /run/gunicorn.sock localhost

According to online forums, this issue is related to the path of my gunicon. gunicron-path

However, my gunicron is set exactly by this path: That is the file -sudo nano /etc/systemd/system/gunicorn.service displays:

Description=gunicorn daemon

ExecStart=/home/nuser/pipit/.venv/bin/gunicorn \
        --access-logfile - \
        --workers 3 \
        --bind unix:/run/gunicorn.sock \


Any advise as on how I can fix it would be highly appreciated.

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.

Site Moderator
Site Moderator badge
May 8, 2023

Hey @leacards,

Usually, the error # Connection reset by peer is related to your Application as a whole rather than configuration.

Check the logs of your Gunicorn application as well as the Nginx logs to see for a more concrete error.

Try DigitalOcean for free

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

Sign up