I'm running a local vagrant VM, Ubuntu 13.10 with nginx reverse proxying to uwsgi.


sudo /etc/init.d/nginx status 


* nginx is running

However running

sudo /etc/init.d/uwsgi status 


* which one?

If I take a look at the log file for the wsgi app I can see that uwsgi is running, worker processes have been created etc... so is there a hidden instance of uwsgi running somewhere that's confusing the service restart command?

I installed uwsgi using:

apt-get install uwsgi

Here's the app.ini file:

plugin = python
socket  = /run/uwsgi/app/myapp/socket
chdir = /var/www/myapp
module = project.wsgi:application
pidfile = /tmp/myapp-master.pid
master = True
daemonize = /var/log/uwsgi/myapp.log

Any ideas?

  • Same issue Ubuntu 14.04 (Trusty) with This has to be a bug, but I don't know if it belongs to the people behind the Ubuntu repository, or to uwsgi. Jul 9, 2015 at 16:20
  • In any case, I just install with PIP instead. PIP does not install it as a service, so I create /etc/init/uwsgi.conf myself. The startup files are much much easier to read and understand (and write) which is another bonus. Jul 9, 2015 at 16:22
  • Just a guess: by default 4 processes with name "uwsgi" are created, and service script can not choose from them by name. Earlier the main process of uwsgi was named uwsgi-emperor but now they are confused.
    – sherdim
    Mar 12, 2020 at 10:00

1 Answer 1


Changing the pidfile option to pidfile2 seems to fix this issue.

pidfile2 = /tmp/myapp-master.pid

Interestingly the service uwsgi stop returns [OK] but the service uwsgi start returns [fail]

So I'm assuming the error happens when a non privileged user (i.e. www-data) is trying to write to the pidfile which has been created by a privileged user (e.g. root).

pidfile2 will create the pidfile after privileges drop - so www-data can happily write to it.

If someone else can shed light on whether this is the case that would be great.


You must log in to answer this question.