I'm trying to set up a unix socket for gunicorn and to ping it from curl (running curl --unix-socket /run/gunicorn.sock http://www.example.com --trace-ascii dump.txt
). Unfortunately, the response from Curl Each time is a curl: (56) Recv failure: Connection reset by peer
.
Looking into the dump log, it shows :
# cat dump.txt
== Info: About to connect() to www.example.com port 80 (#0)
== Info: Trying /run/gunicorn.sock...
== Info: Failed to set TCP_KEEPIDLE on fd 4
== Info: Failed to set TCP_KEEPINTVL on fd 4
== Info: Connected to www.example.com (/run/gunicorn.sock) port 80 (#0)
=> Send header, 79 bytes (0x4f)
0000: GET / HTTP/1.1
0010: User-Agent: curl/7.29.0
0029: Host: www.example.com
0040: Accept: */*
004d:
== Info: Recv failure: Connection reset by peer
== Info: Closing connection 0
I can see that there is a hangup with setting TCP_KEEPIDLE and TCP_KEEPINTVL on fd (file descriptor ?) 4, but not sure what I can do to fix that.
My gunicorn.sock
file looks like this :
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
Edit : I'm trying to follow this guide : https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04