2

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: 88.238.245.17, server: 37.148.208.160, request: "GET / HTTP/1.1", upstream: "http://unix:/home/saba/myproject/myproject.sock:/", host: "37.148.208.160"

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

0

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>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .