Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python sock失败(2:没有这样的文件或目录)Django 1.8,Nginx,Gunicorn_Python_Django_Postgresql_Nginx_Gunicorn - Fatal编程技术网

Python sock失败(2:没有这样的文件或目录)Django 1.8,Nginx,Gunicorn

Python sock失败(2:没有这样的文件或目录)Django 1.8,Nginx,Gunicorn,python,django,postgresql,nginx,gunicorn,Python,Django,Postgresql,Nginx,Gunicorn,我对django项目中的502错误感到困惑。据我所知,nginx未能传递给gunicorn,但我不确定。从这里开始,我非常准确地完成了所有步骤 /etc/systemd/system/gunicorn.service: [Unit] Description=gunicorn daemon After=network.target[Unit] Description=gunicorn daemon After=network.target [Service] User=root Group=ww

我对django项目中的502错误感到困惑。据我所知,nginx未能传递给gunicorn,但我不确定。从这里开始,我非常准确地完成了所有步骤

/etc/systemd/system/gunicorn.service

[Unit]
Description=gunicorn daemon
After=network.target[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=root
Group=www-data
WorkingDirectory=/home/root/glboy
ExecStart=/home/root/glboy/denv/bin/gunicorn --workers 3 --bind unix:/home/root/glboy/closer.sock closer.wsgi:application

[Install]
WantedBy=multi-user.target
/etc/nginx/sites available/closer
/etc/nginx/sites enabled

server {
    listen 80;
    server_name 46.101.192.66;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/glboy/static;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/root/glboy/closer.sock;
    }
}
还找到了
/etc/nginx/sites available/default
也被编辑过的教程,尽管我不完全理解其目的:

 server {
    listen 80;
    server_name 46.101.192.66;
    access_log  /var/log/nginx/example.log;

    location /static/ {
        root /home/glboy/static;
        expires 30d;
    }

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  }
在nginx错误日志中,报告缺少套接字

/home/root/glboy/closer.sock failed (2: No such file or directory)

我刚刚复制了路径,根据指令它应该是怎样的,但是如果它是错误的,那么什么路径是正确的,或者什么路径是错误的?

它可以使用不同的权限工作,并且不能访问
/home/root
。一些web服务器以用户
wwwdata
身份运行,因此黑客无法访问
root
privillages。@furas我尝试了“sudo chown-R root~”是否正确?没有工作您将
root
设置为所有者,但服务器大多数情况下不以
root
运行,并且无法访问
root
文件夹(因此黑客不能使用服务器中的bug以root身份访问服务器上的所有数据)。它可以使用不同的权限工作,并且不能访问
/home/root
。一些web服务器以用户
wwwdata
身份运行,因此黑客无法访问
root
privillages。@furas我尝试了“sudo chown-R root~”是否正确?没有工作您将
root
设置为所有者,但服务器通常不以
root
运行,并且它无法访问
root
文件夹(因此黑客不能使用服务器中的bug以root身份访问服务器上的所有数据)。