Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.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 连接到上游时,Nginx/Gunicorn connect()到.sock出错(111:连接被拒绝)_Python_Ubuntu_Nginx - Fatal编程技术网

Python 连接到上游时,Nginx/Gunicorn connect()到.sock出错(111:连接被拒绝)

Python 连接到上游时,Nginx/Gunicorn connect()到.sock出错(111:连接被拒绝),python,ubuntu,nginx,Python,Ubuntu,Nginx,我已经做了无休止的搜索和尝试来解决这个问题,但这拒绝工作 我正在使用Python 3.3/Gunicorn/Nginx,当我尝试运行我的站点时,我得到: [error] 904#0: *1 connect() to unix:/home/user/project/project.sock failed (111: Connection refused) while connecting to upstream, client: , server: mysite.com, request: "GE

我已经做了无休止的搜索和尝试来解决这个问题,但这拒绝工作

我正在使用Python 3.3/Gunicorn/Nginx,当我尝试运行我的站点时,我得到:

[error] 904#0: *1 connect() to unix:/home/user/project/project.sock failed (111: Connection refused) while connecting to upstream, client: , server: mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:/home/user/project/project.sock:/favicon.ico", host: "mysite.com", referrer: "mysite.com/"
我完全遵循,在多次尝试重新尝试之后,我仍然收到这个错误

以下是我的配置的外观:
/etc/init中的upstart脚本

description "Gunicorn application server running myproject"

    start on runlevel [2345]
    stop on runlevel [!2345]

    respawn          #respawn this on reboot
    setuid user        #set as unix user 'jd' to run as
    setgid www-data  #user used by nginx

    env PATH=/home/user/project/projectenv/bin
    chdir /home/user/project
    exec gunicorn --workers 3 --bind unix:project.sock -m 007 wsgi
srwxrwx--- 1 user www-data 
此文件的权限:

    chmod 644
    user user 373 Dec 13 09:21 homepage.conf
**nginx

config**
    server {
        listen 80;

        server_name mysite.com;

        error_log /home/user/project/nginx_error.log info;

        root /home/user/project/projectenv;

        location / {
            include proxy_params;
            proxy_pass http://unix:/home/user/project/project.sock;
        }

    }
如果我在nginx config的目录中运行
nginx-t
,它会显示:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
/home/user/project/project.sock的权限

description "Gunicorn application server running myproject"

    start on runlevel [2345]
    stop on runlevel [!2345]

    respawn          #respawn this on reboot
    setuid user        #set as unix user 'jd' to run as
    setgid www-data  #user used by nginx

    env PATH=/home/user/project/projectenv/bin
    chdir /home/user/project
    exec gunicorn --workers 3 --bind unix:project.sock -m 007 wsgi
srwxrwx--- 1 user www-data 
my
wsgi.py
文件(如本文所述)包含:

from homepage import application

if __name__ == "__main__":
    application.run()
有趣的是,如果我尝试这个命令:

gunicorn --bind 0.0.0.0:8000 wsgi
概述

Gunicorn启动良好,我可以完美地查看我的页面

真正的问题是,是什么问题导致它不能从
/etc/init
中的
ubuntu启动脚本运行。。。因为脚本正在运行

有人看见什么吗


多谢各位

“拒绝连接”的意思是:您正试图连接到一个主机:端口,在该端口上没有任何内容正在侦听。因此,请找出您正在连接的位置,然后调查您是否使用了错误的信息,或者某些内容应该正在侦听,但它没有。您如何确定“拒绝连接”这意味着:您正试图连接到一个主机:端口,在该端口上没有任何内容正在侦听。因此,请找出您正在连接的位置,然后调查您是否使用了错误的信息,或者某些内容应该正在侦听,但却没有。您如何确定