![我无法以普通用户身份运行 uwsgi](https://linux22.com/image/602231/%E6%88%91%E6%97%A0%E6%B3%95%E4%BB%A5%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E8%BA%AB%E4%BB%BD%E8%BF%90%E8%A1%8C%20uwsgi.png)
我想以www
用户身份运行 uwsgi 服务器,但如果我写:
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
发生套接字创建错误:
日志:
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]
答案1
感谢您更新您的日志。
根据您的日志文件,它显示该地址已被使用。您尝试使用的端口已被使用。
查看netstat -ntp
并确保你绑定的端口尚未被使用
答案2
最可能的情况是,您之前运行时没有使用uid
和gid
参数,因此套接字文件已经存在并由root拥有。sudo rm /path/to/*.sock
,重新启动uwsgi,然后您就应该一切就绪了。