Python 502访问服务器时网关nginx错误

Python 502访问服务器时网关nginx错误,python,ubuntu,nginx,uwsgi,wsgi,Python,Ubuntu,Nginx,Uwsgi,Wsgi,我正在使用nginx+uwsgi+python创建一个简单的“helloworld应用程序”。然而,当我尝试使用我的服务器ip访问时,浏览器中出现坏网关错误 nginx错误日志显示: 2016/12/25 17:23:21 [crit] 10269#10269: *1 connect() to unix:///home/manish/pyapp/pyapp.sock failed (2: No such file or directory) while connecting to upstrea

我正在使用nginx+uwsgi+python创建一个简单的“helloworld应用程序”。然而,当我尝试使用我的服务器ip访问时,浏览器中出现坏网关错误

nginx错误日志显示:

2016/12/25 17:23:21 [crit] 10269#10269: *1 connect() to unix:///home/manish/pyapp/pyapp.sock failed (2: No such file or directory) while connecting to upstream, client: 122.161.59.236, server: 35.154.95.139, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///home/manish/pyapp/pyapp.sock:", host: "35.154.95.139"
以下是我配置的一些文件:

pyapp.ini文件

[uwsgi]
module = wsgi:application

http-socket = :8080

master = true
processes = 5

socket = pyapp.sock
chmod-socket = 660
vacuum = true

die-on-term = true
pyapp/wsgi.py文件

def application(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return ["<h1 style='color:blue'>Hello There!</h1>"]
nginx文件

sudo nano/etc/nginx/sites available/pyapp

server {
    listen 80;
    server_name 35.154.95.139;

    location / {
        include         uwsgi_params;
        uwsgi_pass      unix:/home/manish/pyapp/pyapp.sock;
    }
}
符号链接

manish@ip-17-1-24-27:~/pyapp$ ls -l /etc/nginx/sites-enabled/
total 0
lrwxrwxrwx 1 root root 34 Dec 25 12:13 default -> /etc/nginx/sites-available/default
lrwxrwxrwx 1 root root 32 Dec 25 16:42 pyapp -> /etc/nginx/sites-available/pyapp

非常感谢您的帮助。

此问题与缺少upstart库有关。安装upstart文件后,它工作了。

也许这个问题很愚蠢,但是。。您是否已使用此套接字启用uwsgi?通过安装upstart library解决了此问题
manish@ip-17-1-24-27:~/pyapp$ ls -l /etc/nginx/sites-enabled/
total 0
lrwxrwxrwx 1 root root 34 Dec 25 12:13 default -> /etc/nginx/sites-available/default
lrwxrwxrwx 1 root root 32 Dec 25 16:42 pyapp -> /etc/nginx/sites-available/pyapp