Apache2 mod_wsgi 403禁止错误 [英] Apache2 mod_wsgi 403 forbidden error
问题描述
我已经正确配置了它,但是后来我决定重新安装Debian(顺便说一下,从wheezy版本切换到了jessie版本).问题出在这里:
I had it configured right, but then I decided to reinstall my Debian (switching from wheezy to jessie version by the way). Here's the problem:
我在以下位置有一个python mod_wsgi应用程序:/mnt/doc/Python/www/index.py
.
I have a python mod_wsgi application at: /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错误.其配置如下:
All subdirectories have the same permissions as /mnt/doc
, but still I get 403 Forbidden error, when trying to open the site. It's configuration below:
WSGIScriptAlias /huh /mnt/doc/Python/www/index.py
<Directory /mnt/doc/Python/www>
Order allow,deny
Allow from all
</Directory>
尝试打开页面时,Apache2日志中会显示以下消息:
When trying to open the page, the following message appears in Apache2 log:
[authz_core:error] [pid 15269:tid 140518201730816] [client ::1:44130] AH01630: client denied by server configuration: /mnt/doc/Python/www/index.py
我很确定我复制了以前的配置.最近有什么变化吗?
I'm pretty sure that I copied previous configuration quite exactly. Did anything change recently?
我忽略了补充,我使用的是Python 3.3和libapache2-mod-wsgi-py3 Debian软件包.
I neglected to add that I use Python 3.3 and libapache2-mod-wsgi-py3 Debian package.
推荐答案
我终于解决了. pxl位于右半边,因为不仅Allow from all
应该替换为Require all granted
,而且Order allow,deny
不再是必需的.原来是我出错的原因.完整的脚本别名配置应如下所示:
I solved it finally. pxl was half-right, because not only Allow from all
should be replaced by Require all granted
, but also Order allow,deny
is no longer necessary. It turns out to be the reason for my error. Complete script alias config should be like this:
WSGIScriptAlias /huh /mnt/doc/Python/www/index.py
<Directory /mnt/doc/Python/www>
Require all granted
</Directory>
它有效.
这篇关于Apache2 mod_wsgi 403禁止错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!