gpt4 book ai didi

python - Apache2 mod_wsgi 403 禁止错误

转载 作者:行者123 更新时间:2023-12-04 09:31:18 35 4
gpt4 key购买 nike

我配置正确,但后来我决定重新安装我的 Debian(顺便从 wheezy 切换到 jessie 版本)。这是问题所在:

我有一个 python mod_wsgi 应用程序:/mnt/doc/Python/www/index.py .

$ ls -l / | grep mnt
drwxr-xr-x 3 root root 4096 sty 12 09:36 mnt

$ ls -l /mnt
drwxrwxrwx 1 sven sven 20480 sty 7 19:34 doc

$ ls -l /mnt/doc/Python/www/
total 12
drwxrwxrwx 1 sven sven 4096 Jan 3 19:52 core
-rwxrwxrwx 1 sven sven 0 Dec 22 13:25 __init__.py
drwxrwxrwx 1 sven sven 0 Dec 24 00:11 silva
-rwxrwxrwx 1 sven sven 984 Dec 22 13:47 silva.py
-rwxrwxrwx 1 sven sven 697 Dec 25 13:32 txt

所有子目录的权限与 /mnt/doc 相同,但在尝试打开网站时,我仍然收到 403 Forbidden 错误。它的配置如下:
WSGIScriptAlias /huh /mnt/doc/Python/www/index.py                 
<Directory /mnt/doc/Python/www>
Order allow,deny
Allow from all
</Directory>

尝试打开页面时,Apache2 日志中出现以下消息:
[authz_core:error] [pid 15269:tid 140518201730816] [client ::1:44130] AH01630: client denied by server configuration: /mnt/doc/Python/www/index.py

我很确定我完全复制了以前的配置。最近有什么变化吗?

编辑:我忽略添加我使用 Python 3.3 和 libapache2-mod-wsgi-py3 Debian 包。

最佳答案

我终于解决了。 pxl 说对了一半,因为不仅Allow from all应替换为 Require all granted ,还有Order allow,deny不再需要。事实证明这是我错误的原因。完整的脚本别名配置应该是这样的:

WSGIScriptAlias /huh /mnt/doc/Python/www/index.py                 
<Directory /mnt/doc/Python/www>
Require all granted
</Directory>

它有效。

关于python - Apache2 mod_wsgi 403 禁止错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21122121/

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