gpt4 book ai didi

django - Apache2 + VirtualEnv IOError : [Errno 13] Permission denied

转载 作者:行者123 更新时间:2023-12-02 07:30:34 25 4
gpt4 key购买 nike

我无法通过 virtualenv(和 virtualenvwrapper)让 apache 为我的网站提供服务。我尝试按照演练 here 进行操作。值得注意的是,我使用的是 Ubuntu Server v13.10,据我所知,它还没有对 Apache v2.2 的本地支持,因此在演练中我无法安装 apache2.2-common。但是,我认为这不是问题,因为 apache 错误日志说存在权限问题。

在我的设置中,虚拟环境位于非 root 用户的主目录中,而 apache 服务器以 root 身份运行(我认为这是正常的)。我已尝试使用 namei 跟踪权限,并确保 chmod +rwroot 的身份进入路径。有任何想法吗?

[Thu Mar 06 14:16:37.639031 2014] [mpm_event:notice] [pid 8771:tid 140338386122624] AH00489: Apache/2.4.6 (Ubuntu) mod_wsgi/3.4 Python/2.7.5+ configured -- resuming normal operations
[Thu Mar 06 14:16:37.639144 2014] [core:notice] [pid 8771:tid 140338386122624] AH00094: Command line: '/usr/sbin/apache2'
[Thu Mar 06 14:16:53.456622 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] mod_wsgi (pid=8775): Target WSGI script '/var/www/www.mysite.org/index.wsgi' cannot be loaded as Python module.
[Thu Mar 06 14:16:53.456735 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] mod_wsgi (pid=8775): Exception occurred processing WSGI script '/var/www/www.mysite.org/index.wsgi'.
[Thu Mar 06 14:16:53.456782 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] Traceback (most recent call last):
[Thu Mar 06 14:16:53.456830 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] File "/var/www/www.mysite.org/index.wsgi", line 16, in <module>
[Thu Mar 06 14:16:53.456918 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] execfile(activate_env, dict(__file__=activate_env))
[Thu Mar 06 14:16:53.456971 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] IOError: [Errno 13] Permission denied: '/home/nrUser/Envs/mysite/bin/activate_this.py'
(mysite)root:~# namei -m /home/nrUser/Envs/mysite/bin/activate_this.py
f: /home/nrUser/Envs/mysite/bin/activate_this.py
drwxr-xr-x /
drwxr-xr-x home
drw-r--r-- nrUser
drwxrwxr-x Envs
drwxrwxr-x mysite
drwxrwxr-x bin
-rwxrwxr-x activate_this.py

最佳答案

为了能够访问这些文件,apache 所有者至少需要在您的文件之上的所有目录上拥有 x 位,并在文件本身上拥有 r 位。您的 nrUser 目录缺少 x 位; chmod 755/home/nrUser 应该可以解决您的问题。

关于django - Apache2 + VirtualEnv IOError : [Errno 13] Permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22234238/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com