Report this

What is the reason for this report?

Django/Nginx/Gunicorn "unknown errors" in nginx logs

Posted on July 17, 2025

Trying to deploy a Django/Nginx/Gunicorn project, I cannot resolve a 502 Bad Gateway issue. Looking at nginx logs, I see “104: unknown error” and “111: unknown error”-- which seems kind of uninformative. How do I debug this further?

p.s. the most recent error recorded goes like this: "*28 connect() to unix:/home/username/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: IP_ADDRESS, server: _, request: “GET / HTTP/1.1”, upstream: “http://unix:/home/username/gunicorn.socket:/”, host: “MY_DROPLET_IP_ADDRESS:80” "

I can post some details of my gunicorn.service and nginx configuration if this isn’t enough… been fighting with this for hours, coming from Apache2 and WSGI it’s a lot more moving pieces.



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.

Hi there,

Sounds like your Gunicorn socket isn’t being created or Nginx isn’t pointing at it correctly.

This DigitalOcean guide on setting up Django with Postgres, Nginx & Gunicorn walks through creating the systemd socket, service files, and Nginx proxy config, double check those steps:

https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu

Look into your Gunicorn systemd logs (e.g. journalctl -u gunicorn.socket) and your Nginx error logs, you’ll usually find clues like missing socket files, permission issues, or path problems.

If everything matches the tutorial but it’s still failing, post your gunicorn.socket, gunicorn.service, and Nginx site config. That way the community could advise you better.

- Bobby

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.