我不能像普通用户一样运行uwsgi

我想运行uwsgi服务器作为www用户,但如果我写:

 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 

发生套接字创build错误:

日志:

  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] 

感谢您的日志更新。

根据你的日志文件说,地址已被使用。 您尝试使用的端口已被使用。

查看netstat -ntp并确保您绑定的端口尚未被使用

最有可能的情况是你之前运行的时候没有uidgid参数,所以套接字文件已经存在并且被root所拥有。 sudo rm /path/to/*.sock ,重新启动uwsgi,你应该全部设置。