【问题标题】:supervisor and uWSGI will not work together along with nginxsupervisor 和 uWSGI 不能与 nginx 一起工作
【发布时间】:2012-06-16 20:14:34
【问题描述】:

我使用 supervisord 来管理龙卷风,使用 nginx 作为负载平衡器没有问题。

我在使用 nginx 作为负载平衡器的主管和 uWSGI 方面遇到严重问题。我使用瓶子作为框架。

当我从命令行运行以下命令并在 FF 中加载一个页面并点击 nginx 时,一切正常。

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;
                 }

【问题讨论】:

    标签: python nginx uwsgi supervisord


    【解决方案1】:

    您可能会在 supervisord 配置中添加更多参数,例如 uwsgi 命令的 --pp(python 路径),可能还有一些环境变量:

    [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 特定的设置

    【讨论】:

    • 嗨,它不是一个 django 应用程序。没有静态目录。
    • 操作,抱歉,刚刚查看了我的一个配置。您是否尝试将 --pp 添加到命令中?
    猜你喜欢
    • 1970-01-01
    • 2013-05-19
    • 1970-01-01
    • 2017-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多