Report this

What is the reason for this report?

gunicorn - failure: Connection reset by peer

Posted on May 8, 2023

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:

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=nuser
Group=www-data
WorkingDirectory=/home/nuser/pipit
ExecStart=/home/nuser/pipit/.venv/bin/gunicorn \
        --access-logfile - \
        --workers 3 \
        --bind unix:/run/gunicorn.sock \
        pipit.wsgi:application

[Install]
WantedBy=multi-user.target

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



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!

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.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.