Answer the question
In order to leave comments, you need to log in
How to give permission to nginx?
I'm making a python flask web application using gunicorn, uwsgi, nginx. The application works, but the problem is with nginx. I did it using the forum . At step 5, I did everything correctly, but I looked at the logs and there is an error
2020/05/28 15:17:11 [crit] 318#318: *1 connect() to unix:/root/myproject/myproject.sock failed (13: Permission denied) while connecting to upstream, client: "тут айпи", server: "тут сервер", request: "GET / HTTP/1.1", upstream: "http://unix:/root/myproject/myproject.sock:/", host: "тут хост"
server {
listen 80;
server_name "тут домен" "www.тут домен";
location / {
include proxy_params;
proxy_pass http://unix:/root/myproject/myproject.sock;
}
}
[Unit]
Description=Gunicorn instance to serve myproject
After=network.target
[Service]
User=sammy
Group=www-data
WorkingDirectory=/root/myproject
Environment="PATH=/root/myproject/myprojectvenv/bin"
ExecStart=/root/myproject/myprojectvenv/bin/gunicorn --workers 3 --bind unix:myproject.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
Answer the question
In order to leave comments, you need to log in
Well, firstly - do not work as a root. Never.
Secondly, without touching the horror ( proxy_pass http://unix:/root/myproject/myproject.sock; ), which is written in your config, even if you raise the socket in the root folder, the web server does not have access there.
The problem is the lack of necessary access for nginx. We recommend that you familiarize yourself with similar cases:
https://coderoad.ru/48953472/502-%D0%BF%D0%BB%D0%B...
https://stackoverflow.com/questions/23443398/nginx...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question