2012-08-07 93 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