2016-12-25 2 views
0

nginx + uwsgi + python을 사용하여 간단한 "Hello World 앱"을 만들고 있습니다. 그러나 내 서버 IP를 사용하여 액세스하려고하면 브라우저에서 잘못된 게이트웨이 오류가 발생합니다.서버에 액세스하는 동안 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>"] 

업 스타트 파일 /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 파일

sudo를 나노/등 /의 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

upstart 라이브러리를 설치하여 문제가 해결되었습니다. –

답변

0

문제는 upstart 라이브러리가 누락 된 것과 관련이 있습니다. upstart 파일을 설치 한 후 작동했습니다.

관련 문제