mod_wsgi无法连接WSGI守护进程 [英] mod_wsgi unable to connect WSGI daemon process
问题描述
我正在使用Easy apache 4,mod_wsgi和Python 3.5。当我在服务器中调用Django项目时,出现以下错误:
I am using Easy apache 4, mod_wsgi, and Python 3.5. When I called a Django project in the server I got the following error:
(13)Permission denied: mod_wsgi (pid=24223): Unable to connect to WSGI daemon
process 'user123' on '/var/run/wsgi.8442.6.7.sock' as user with uid=3708.
推荐答案
您的Apache安装可能已设置为与安全
特权模式。这意味着在处理请求之前,将派生Apache子工作进程并丢弃特权,在这种情况下,这只是尝试将请求代理到mod_wsgi守护进程。这样做的结果是,它无法连接到守护进程的套接字,因为它被设置为拥有权,以匹配放弃特权之前的原始Apache子工作者进程。
Your Apache installation is likely set up to run with SECURE
privileges mode. This means that the Apache child worker process is forked and privileges dropped before handling the request, which in this case is simply trying to proxy the request through to the mod_wsgi daemon process. The consequence of this is that it cannot connect to the socket for the daemon process, as it was setup with ownership to match the original Apache child worker process before privileges were dropped.
这很明显,因为错误消息中的 uid
在普通用户范围内,而不是特殊的 apache
或 nobody
用户。
This is evident because the error message has uid
in the range of a normal user and not the special apache
or nobody
user.
要修复此问题,您需要修改 WSGIDaemonProcess
指令配置并添加选项:
To fix it, you need to modify the WSGIDaemonProcess
directive configuration and add the option:
socket-user=#3708
或:
socket-user=username
其中用户名
替换为实际名称的用户,其中 uid
为 3708
。
where username
is replaced with the actual name of the user with uid
of 3708
.
由于最近在Apache的CPanel配置中进行了更改,因此似乎需要添加此选项。
The addition of this option seems to be required due to recent changes in CPanel configurations for Apache.
这篇关于mod_wsgi无法连接WSGI守护进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!