First, I'm new to this subject. So I'm trying to serve a hello world flask app with nginx and gunicorn on a Centos7 server. But I'm getting 502 error on website. When I checked nginx's error.log file I see this:

*32 connect() to unix:/home/saba/myproject/myproject.sock failed (2: No such file or directory) while connecting to upstream, client:, server:, request: "GET / HTTP/1.1", upstream: "http://unix:/home/saba/myproject/myproject.sock:/", host: ""

Where can I find this sock file? Or how shuold it be generated? As far as I guess there is none in my project.

1 Answer 1


Gunicorn should create a TCP/IP or Unix socket and listen for requests on it. You correctly gave the path to the Unix socket in nginx configuration, but you didn't tell Gunicorn to create it:

gunicorn -b unix:/home/saba/myproject/myproject.sock <the rest of your options>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.