2012-11-24 3 views
0

플라스크 애플리케이션을 개발하고 있지만 서버 구성을 위해 4 시간이 지나면 알아낼 수 없습니다.nginx + uwsgi의 플라스크

  • VM이 xx.xx.xx.xx를 통해 액세스 할 수 있습니다 : 여기

    이 일이이 서버에 81

  • , 내 응용 프로그램은시의 경우 :/var/HG/저장소/데이터/test.py

내가 xx.xx.xx.xx 통해 응용 프로그램에 액세스하고 싶습니다 : 81/WS

이 내가 내가 nginx를했던 것이있다 : xx.xx.xx.xx에가는

uwsgi: 
    socket: 127.0.0.1:9090 
    master: 1 
    workers: 1 
    chmod-socket: 666 
    auto-procname: 1 
    python-path: . 
    pidfile: /tmp/uwsgi.pid 
    daemonize: /var/log/uwsgi.log 
    module: test:app 

:

location = /var/hg/repositories/data { rewrite^/var/hg/repositories/data/; } 
    location /ws { try_files $uri @ws; } 
    location @ws { 
     include uwsgi_params; 
     uwsgi_param SCRIPT_NAME /var/hg/repositories/data; 
     uwsgi_modifier1 30; 
     uwsgi_pass unix:/tmp/uwsgi.sock; 
    } 

내가 점심 uwsgi에 YAML 파일이 81 나에게 고전의 nginx 환영 메시지를 제공합니다.

xx.xx.xx.xx에가는 : 81/WS는 나에게 (404)

내가 뭘 잘못을 준다?

conf의 업데이트 후, 나는이

location = /var/hg/repositories/data/ 
    location /var/hg/repositories/data/ { try_files $uri @web } 
    location @ws { 
      uwsgi_pass unix:/tmp/uwsgi.sock; 
    } 

내 uwsgi의 conf :

당신은 uWSGI에서 응용 프로그램을 "마운트"해야
uwsgi: 
    socket: unix:/tmp/uwsgi.lock 
    master: 1 
    workers: 1 
    chmod-socket: 666 
    auto-procname: 1 
    pidfile: /tmp/uwsgi.pid 
    deamonize: /var/log/uwsgi.log 
    manage-script-name: true 
    mount: /ws=/var/hg/repositories/data/test.py 
    callable: app 

답변

2

, 현재 당신이이 "설치"그것은 비어 SCRIPT_NAME

마운트 : /ws=test.py

호출 : 응용 프로그램

('module'지시문을 제거하십시오) 트릭을 수행합니다.

SCREIPT_NAME을 (를) 관리하는 것이 좋습니다. modifier1 30을 사용하면 정말 못생긴 해킹입니다. 지금 uswgi ImportError를이 "저를주고 통해 진행 상태에서, 당신의 도움에 대한 진정한 uWSGI에 상황을

+0

탱크 :

그냥-관리 스크립트 이름의 nginx에서 uwsgi_param 및 uwsgi_modifier1 모두를 제거하고 추가 할 수 있습니다. 파일 이름을 기준으로 가져 오기가 지원되지 않습니다 응용 프로그램 0 (mountpoint = '/ ws') (호출 가능 찾을 수 없거나 가져 오기 오류)을로드 할 수 없습니다. "오류가 발생했습니다. 참고로, 내 test.py는 단지 플라스크 홈페이지에있는 기본 예제입니다. – billyJoe

+0

내 응답을 편집했습니다. 마운트 및 호출 가능이 다른 줄에 있어야한다는 것이 확실하지 않다고 생각합니다. – roberto

+0

내 초기 게시물을 업데이트하고, 내 구성을 조정했습니다. . uwsgi는 /ws에있는 var/hg/repositories/data/test.py를 반환합니다. 인터프리터 0x96db410에서 WSGI 앱 0 (마운트 지점 = '/ ws') 0 초가 준비 됨 pid : 21194 (기본 앱) .xx.xx.xx : 81/ws – billyJoe