I am trying to test a pilot system with nginx connecting to uwsgi served application controlled by supervisord running on ubuntu-server. Application is written in python with Flask in virtualenv, although I'm not sure if that is relevant. To test the system I have created a simple hello world with flask. I want nginx and uwsgi both to run as www-data user.
If I launch uwsgi "manually" from root shell I can see uwsgi processes runing as appropriate user (www-data). Although, if I let supervisor launch the application something strange happens - uwsgi processes are runing under my user (friendzis). Consequently, socket file gets created under wrong user and nginx cannot communicate with my applicaion.
note: the linux server runs as Hyper-V VM, under Windows Server 2008.

Relevant configuration:


socket = /var/www/sockets/cowsay.sock
chmod-socket = 666
abstract-socket = false

master = true
workers = 2

uid = www-data
gid = www-data

chdir = /var/www/cowsay/cowsay
pp = /var/www/cowsay/cowsay
pyhome = /var/www/cowsay
module = cowsay
callable = app


command = /var/www/cowsay/bin/uwsgi -s /var/www/sockets/cowsay.sock -w cowsay:app
directory = /var/www/cowsay/cowsay
user = www-data
autostart = true
autorestart = true
stdout_logfile = /var/www/cowsay/log/supervisor.log
redirect_stderr = true
stopsignal = QUIT

I'm sure I'm missing some minor detail, but I'm unable to notice it. Would appreciate any suggestions.


You should specify an environment option in the program section. For example:


See Subprocess Environment for details.

Also, a similar solution is proposed on stackoverflow


How do your run supervisord ? are you sure you did not run it from the shell (with your uid) ?

Are you sure you need supervisord ? You can easily attach uWSGI to upstart or systemd (eventually with the uWSGI Emperor)

  • I'm runing supervisord as a System V service (installed with apt-and-friends). Supervisord itself runs as root (output from ps confirms that). I've tried rebooting the VM, and logging in directly to a root shell only to witness the same result. I just can't figure out where that UID 1000 comes from. I'm not sure if I REALLY need supervisor, but it seems to be a nice tool to control related non-WSGI apps
    – friendzis
    Oct 21 '13 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.