我在Ubuntu 12上运行uwsgi时遇到了一些权限问题。这是我的ini文件:
[uwsgi]
project = djangorpoject
base_dir = /home/mysite/mysite.com
uid = www-data
gid = www-data
plugins = http,python
processes = 4
harakiri = 60
reload-mercy = 8
cpu-affinity = 1
max-requests = 2000
limit-as = 512
reload-on-as = 256
reload-on-rss = 192
no-orphans = True
#vacuum = True
master = True
logto = /var/log/uwsgi/%n.log
#daemonize = /var/log/uwsgi/%n.log
#catch-exceptions
disable-logging
virtualenv = %(base_dir)/venv
chdir = %(base_dir)
module = %(project).wsgi:application
socket = /run/uwsgi/%n.sock
chmod-socket = 666
chown-socket = www-data:www-data
如您所见,我正在对套接字文件运行chmod和chown命令。当我尝试加载我的网站时,出现了以下错误:
bind(): Permission denied [socket.c line 107]
如果我运行,这个问题就会消失。
sudo chown -R www-data:www-data /run/uwsgi
但是当我重启服务器时,这种设置就会消失。我猜测这是因为uwsgi在启动时重新创建了文件夹?有没有办法将权限永久应用于套接字?