2012-08-07 96 views
0

我是新手,我只能用Emperor來運行2個Django骨架應用(只顯示「It works!」頁面),但我想試試而不是皇帝。 (以更好地瞭解它是如何工作)Nginx + uWSGI基本配置

我的nginx.conf:

# snipped... 
server { 
    listen 92; 
    server_name example.com; 
    access_log /home/john/www/example.com/logs/access.log; 
    error_log /home/john/www/example.com/logs/error.log; 

    location/{ 
    include uwsgi_params; 
    uwsgi_pass 127.0.0.1:8001; 
    } 
} 
# snipped... 

我做起uWSGI通過:

$ uwsgi --ini /home/john/www/example.com/uwsgi.ini 

隨着uwsgi.ini之中:

[uwsgi] 
http = :8001 
chdir = /home/john/www/example.com/example 
module = example.wsgi 
master = True 
home = /home/john/Envs/example.com 

一旦uwsgi和nginx正在運行,我可以訪問localhost:8001,但不能訪問localhost:92

我錯過了什麼?

在此先感謝。

回答

1

您正在告訴uwsgi進程爲使用http協議的應用程序提供服務。此功能主要是爲了方便開發人員。您應該改爲告訴它使用uwsgi協議:

[uwsgi] 
protocol = uwsgi 
socket = 127.0.0.1:8001 
chdir = /home/john/www/example.com/example 
module = example.wsgi 
master = True 
home = /home/john/Envs/example.com