[英]Apache2 mod_wsgi 403 forbidden error
I had it configured right, but then I decided to reinstall my Debian (switching from wheezy to jessie version by the way). 我把它配置正确,但后来我决定重新安装我的Debian(顺便提一下从wheezy切换到jessie版本)。 Here's the problem: 这是问题所在:
I have a python mod_wsgi application at: /mnt/doc/Python/www/index.py
. 我有一个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
All subdirectories have the same permissions as /mnt/doc
, but still I get 403 Forbidden error, when trying to open the site. 所有子目录都具有与/mnt/doc
相同的权限,但在尝试打开网站时仍然会收到403 Forbidden错误。 It's configuration below: 它的配置如下:
WSGIScriptAlias /huh /mnt/doc/Python/www/index.py
<Directory /mnt/doc/Python/www>
Order allow,deny
Allow from all
</Directory>
When trying to open the page, the following message appears in Apache2 log: 尝试打开页面时,Apache2日志中会显示以下消息:
[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? 最近发生了什么变化?
EDIT: I neglected to add that I use Python 3.3 and libapache2-mod-wsgi-py3 Debian package. 编辑:我忽略了添加我使用Python 3.3和libapache2-mod-wsgi-py3 Debian软件包。
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. pxl是半权利的,因为不仅Allow from all
应该被Require all granted
替换,而且还Order allow,deny
不再需要Order allow,deny
。 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>
And it works. 它有效。
Replace Allow from all
with Require all granted
. 将Allow from all
替换为Allow from all
Require all granted
。
Reference for Apache module mod_authz_core
Apache模块mod_authz_core
参考
I wrote like below, 我写的如下,
WSGIScriptAlias /hello /home/myself/projects/hello/hello.wsgi
<Directory /home/myself/projects/hello>
Order allow,deny
Allow from all
Require all granted
</Directory>
and it works 它的工作原理
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.