我的gunicorn服务未创建任何.sock文件

时间:2019-01-16 17:57:44

标签: django nginx centos gunicorn

托管网站时出现以下问题。我在这里配置了所有.conf文件:

gunicorn.service

[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=user
Group=nginx
WorkingDirectory=/root/myproject
ExecStart=/root/myproject/myprojectenv/bin/gunicorn --workers 3 --bind 
unix:/root/myproject/myproject.sock myproject.wsgi:application
[Install]
WantedBy=multi-user.target  

和我的nginx.conf

    server {
    listen 80;
server_name agros.uz www.agros.uz;

location = /favicon.ico { access_log off; log_not_found off; }

location /static/ {
       root /root/myproject/;
}

location / {
   proxy_set_header Host $http_host;
   proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_pass http://unix:/root/myproject/myproject.sock;
    }
}

但是我遇到以下错误

unix:/root/myproject/myproject.sock failed (2: No such file or directory) while connecting to upstream, client: 37.9.113.208, server: agros.uz, request: "GET /uz/insurance?type=physical&page=2&page=7&page=6&page=8&page=4 HTTP/1.1", upstream: "http://unix:/root/myproject/myproject.sock:/uz/insurance?type=physical&page=2&page=7&page=6&page=8&page=4", host: "agros.uz"

当我访问域时,发生此错误502 Bad Gateway错误

并且没有在/root/myproject/myproject.sock文件中提到的在gunicorn.service中创建.sock文件。

0 个答案:

没有答案