主管和uWSGI不会与nginx一起工作

时间:2012-06-13 19:44:30

标签: python nginx uwsgi supervisord

我使用supervisord管理龙卷风而没有使用nginx作为负载均衡器的问题。

我遇到了主管和uWSGI的严重问题,nginx作为负载突发。我使用瓶子作为框架。

当我从命令行运行下面的内容并在FF中加载一个页面时,所有内容都很好。

sudo command = /usr/local/bin/uwsgi --loop gevent --socket 127.0.0.1:8070 --wsgi-file /home/ubuntu/workspace/uwsgiServer.py -b 32768 --master --async 5 --enable-threads --listen 100 --uid root

如果我将命令行放在supervior中,那么我找不到页面。

uWSGI Error
Python application not found



[program:uwsgi]
#autostart=true
#autorestart=true
#process_name = uwsgi-%(process_num)s
command = /usr/local/bin/uwsgi --loop gevent --socket 127.0.0.1:8070 --wsgi-file /home/ubuntu/workspace//uwsgiServer.py -b 32768 --master --async 5 --enable-threads --listen 100 --uid root
#--port=%(process_num)s
#--log_file_prefix=%(here)s/logs/%(program_name)s-%(process_num)s.log
#numprocs = 1
#numprocs_start = 8070

以下是nginx.conf文件的相关部分:

upstream uwsgi_b {
      server 127.0.0.1:8070;
    }


location /u/ {
                       include uwsgi_params;
                       uwsgi_param X-Real-IP $remote_addr;
                       uwsgi_param Host $http_host;
                       uwsgi_pass uwsgi_b;
                 }

1 个答案:

答案 0 :(得分:5)

您可能可能会向supervisord配置添加更多参数,例如--pp(python path)到uwsgi命令,也许还有一些环境变量:

[program:uwsgi]
command = /usr/local/bin/uwsgi 
    --loop gevent 
    --socket 127.0.0.1:8070 
    --wsgi-file uwsgiServer.py 
    --buffer-size 32768 --master --async 5 --enable-threads --listen 100 --uid root 
    --pp /home/ubuntu/workspace/

autostart=true
autorestart=true
environment=ENV_VAR='var'
user=root # or other
group=root # or other
directory=/home/ubuntu/workspace/
umask=022

编辑:删除了Django特定的设置