【发布时间】:2021-04-26 23:47:43
【问题描述】:
我正在尝试运行 nginx 和 uwsgi。
当我尝试使用 proj 用户在我的 proj 虚拟环境中使用以下命令运行 uwsgi 时,出现错误。当我运行 uwsgi 时,我看到 proj.sock 是在 /run/uwsgi/proj.sock 中创建的
我将/run/uwsgi 权限更改为drwxrwxrwx 以查看问题是否与权限相关。但问题仍然出现。我也查了/etc/passwd,没有uwsgi用户。
/run/uwsgi 的目录信息是:
drwxrwxrwx 2 root root 60 Jul 16 10:53 uwsgi
当我尝试在 proj 虚拟环境中将 sock 文件的所有权更改为 proj:nginx 时,我收到以下错误。
chown: changing ownership of ‘/run/uwsgi/proj.sock’: Operation not permitted
当我检查/run/uwsgi/proj.sock 文件时,它是proj:proj,但它应该更改为proj:nginx。此操作可以使用 root 手动完成。但它不能用 proj 用户完成。
运行以下命令:
uwsgi --ini /etc/uwsgi/sites/proj.ini
错误:
[uWSGI] getting INI configuration from /etc/uwsgi/sites/proj.ini<br>
*** Starting uWSGI 2.0.15 (64bit) on [Mon Jul 16 10:53:02 2018] ***<br>
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-28) on 13 July 2018 17:12:50<br>
os: Linux-3.10.0-862.6.3.el7.x86_64 #1 SMP Tue Jun 26 16:32:21 UTC 2018<br>
nodename: localhost.localdomain<br>
machine: x86_64<br>
clock source: unix<br>
detected number of CPU cores: 2<br>
current working directory: /home/proj<br>
detected binary path: /home/proj/Env/proj/bin/uwsgi<br>
!!! no internal routing support, rebuild with pcre support !!!<br>
chdir() to /home/proj/work/proj<br>
your processes number limit is 4096<br>
your memory page size is 4096 bytes<br>
detected max file descriptor number: 1024<br>
lock engine: pthread robust mutexes<br>
thunder lock: disabled (you can enable it with --thunder-lock)<br>
chown(): Operation not permitted [core/utils.c line 2623]<br>
VACUUM WARNING: unix socket /run/uwsgi/proj.sock changed inode. Skip removal
我的proj.ini uwsgi ini 配置文件是:
[uwsgi]
py-autoreload = 2
project = proj
username = proj
base = /home/%(username)
chdir = %(base)/%(project)
home = %(base)/Env/%(project)
module = %(project).wsgi:application
master = true
processes = %k
uid = %(username)
socket = /run/uwsgi/%(project).sock
chown-socket = %(username):nginx
chmod-socket = 666
vacuum = true
#logto = /var/log/uwsgi/%(project).log
【问题讨论】:
-
当我删除“chown-socket = %(username):nginx”时,uwsgi 启动。所以我认为这条线会导致问题。