I want to run uwsgi server as www user, but if I write:

uwsgi --socket $SOCKET --chmod-socket 666 --pidfile $PIDFILE --daemonize $LOGFILE --chdir $CHDIR --pp $PYTHONPATH --module main --post-buffering 8192 --workers 1 --threads 10 --uid www --gid www

A socket creation error occurs:


  1 *** Starting uWSGI 1.4.1 (64bit) on [Mon Dec 10 22:15:23 2012] ***
  2 compiled with version: 4.4.5 on 17 November 2012 23:31:14
  3 os: Linux-2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012
  4 nodename: autoblog
  5 machine: x86_64
  6 clock source: unix
  7 pcre jit disabled
  8 detected number of CPU cores: 2
  9 current working directory: /
 10 writing pidfile to /tmp/uwsgi_mysite.pid
 11 detected binary path: /usr/local/bin/uwsgi
 12 setgid() to 1002
 13 set additional group 1004 (files)
 14 setuid() to 1002
 15 *** WARNING: you are running uWSGI without its master process manager ***
 16 your memory page size is 4096 bytes
 17 detected max file descriptor number: 1024
 18 lock engine: pthread robust mutexes
 19 unlink(): Operation not permitted [core/socket.c line 109]
 20 bind(): Address already in use [core/socket.c line 141]
  • try posting your uWSGI configure and the log output. I would check your socket location. Something like /var/uwsgi is a good location. – Sc0rian Dec 10 '12 at 16:54
  • Ok, updated with log – atomAltera Dec 10 '12 at 18:18

Thanks for updating with your log.

According to your log file it says the address is already in use. The port you are trying to use is in use already.

look at netstat -ntp and make sure the port you are binding to is not already in use


the most likely scenario is that you were previously running without the uid and gid arguments, thus the socket files are already existing and owned by root. sudo rm /path/to/*.sock, restart uwsgi, and you should be all set.

  • How do I find the location of the socket files? – Jeremy T Aug 18 '16 at 22:01
  • I'd look in the .ini files. if you don't know where those are, use lsof – jcomeau_ictx Aug 21 '16 at 18:05

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.