首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >uWSGI权限问题

uWSGI权限问题
EN

Server Fault用户
提问于 2014-02-04 17:13:35
回答 1查看 9.4K关注 0票数 6

我正在尝试设置一个厨师食谱,使我的网站运行,一切似乎都很好,除了uWSGI,它给了我以下错误:

代码语言:javascript
复制
*** has_emperor mode detected (fd: 6) ***
[uWSGI] getting INI configuration from app-cms.ini
removed uwsgi instance app-cms.ini

不再这样说:

代码语言:javascript
复制
open("/var/www/app-cms/logs/uwsgi.log"): Permission denied [utils.c line 246]

现在正在创建该日志文件,并包含以下内容:

代码语言:javascript
复制
*** Starting uWSGI 1.0.3-debian (64bit) on [Thu Feb  6 12:00:43 2014] ***
compiled with version: 4.6.3 on 17 July 2012 02:26:54
current working directory: /etc/uwsgi/apps-enabled
writing pidfile to /var/www/ediflo-cms/run/ediflo-cms.pid
detected binary path: /usr/bin/uwsgi-core
setgid() to 33
setuid() to 33
chdir(): Permission denied [uwsgi.c line 1723]
chdir(): Permission denied [uwsgi.c line 975]

我不知道它想要chdir()去哪里。

我在皇帝模式下启动uWSGI,并让它使用以下upstart配置文件监视/etc/uwsgi/apps-enabled/查找ini文件:

代码语言:javascript
复制
description "uWSGI"
start on runlevel [2345]
stop on runlevel [06]

respawn

exec uwsgi --emperor /etc/uwsgi/apps-enabled --uid uwsgi --gid www-data --logto /var/log/uwsgi/uwsgi.log

这是我的uWSGI应用程序配置:

代码语言:javascript
复制
[uwsgi]
; define variables to use in this script
; process name for easy identification in top
project = app-cms
base_dir = /var/www/app-cms
chdir = %(base_dir)

pythonpath = %(base_dir)/env/bin

uid = www-data
gid = www-data

procname = %(project)

; This value needs to be tuned
workers = 4

; Create pid file for easier process management
pidfile = %(base_dir)/run/%(project).pid

; Specify your app here
module = %(project)-wsgi:application

log-reopen = true
logto = %(base_dir)/logs/uwsgi.log

chmod-socket = 660

vacuum = True
enable-threads = True

; unix socket
socket = /tmp/app-cms-server.sock
; Enable stats
stats = /tmp/app-cms-stats.sock
EN

回答 1

Server Fault用户

回答已采纳

发布于 2014-02-05 07:50:47

如果皇帝以非特权用户的身份运行,那么附庸就不能降到特定的uid和gid中,更重要的是,主根目录没有意义(使用它通常是个坏主意,它只适用于需要访问硬件以实现特定功能的嵌入式系统)。

检查/var/www/app-cms/log/uwsgi.log是否已经存在并为root所有,很可能这是以前尝试的结果,现在非特权进程无法以写模式访问它。

最后,不要将皇帝和附庸映射到同一个日志文件,这是隐式的,因为文件描述符2是继承的,如果附属国拥有与皇帝不同的权限(不是您的情况),可能会导致各种问题。

票数 3
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/573133

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档