2016-12-25 30 views
0

。但是,當我嘗試使用我的服務器IP訪問時,瀏覽器中出現錯誤的網關錯誤。使用nginx + uwsgi + python創建一個簡單的「Hello World應用程序」,同時訪問服務器時502壞門戶nginx

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>"] 

Upstart文件/etc/init/pyapp.conf

description "uWSGI instance to serve pyapp" 

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

setuid manish 
setgid www-data 

script 
    cd /home/manish/pyapp 
    . pyappenv/bin/activate 
    uwsgi --ini pyapp.ini 
end script 

nginx的文件

須藤納米的/ etc/nginx的/網站可用/ pyapp

server { 
    listen 80; 
    server_name 35.154.95.139; 

    location/{ 
     include   uwsgi_params; 
     uwsgi_pass  unix:/home/manish/pyapp/pyapp.sock; 
    } 
} 

symbolik鏈接

[email protected]:~/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 

任何幫助表示讚賞。

+0

也許這個問題是愚蠢的,但..你有沒有啓用這個插座uwsgi? –

+0

安裝暴發戶庫後,問題得到解決 –

回答

0

該問題與缺少新貴圖書館有關。在安裝暴發戶文件後,它工作。

相關問題