supervisor and uWSGI will not work together along with nginx

nginx, python, supervisord, uwsgi

Solution

You might probably add some more params to supervisord config, like --pp (python path) to the uwsgi command, and maybe some environment variables:

[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

EDIT: Removed Django-specific settings

Problem

I use supervisord for managing tornado with no issuse wnhile using nginx as a load balancer. I am having severe issues with supervisor and uWSGI with nginx as a load blancer. I am using bottle as the framework. when I run the below from the command line and I load a page in FF hitting nginx, all works great. ``` 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 ``` If I place the command line in supervior then I get page not found. ``` 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 ``` Here are the relevant portions of the nginx.conf file: ``` 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; } ```

Original source