Apache2.4部署django出现403Forbidden错误解决办法

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

前言:Apache2.4部署django出现403 Forbidden错误最好要结合apache中的错误日志来观察出现何种错误导致出现403错误

下午百度了一下午没找到解决办法,试了n种方法,简直坑爹!

比如网页出现最多的解决办法是:

<Directory E:/wamp/Apache24/www(你的工程路径)>

Order allow,deny

Allow from all

</Directory>

可惜这样改了后还是报403,最后想起来查看err.log一看报client denied by server configuration: E:/wamp/Apache24/www/www/wsgi.py,当时各种吐血呀,后来还是到开源社区找到一个网页,进去才找到解决办法

方法解决网址:https://mikegriffin.ie/blog/20140130-authz-core-error-client-denied-by-server-configuration/

正文:其实在前面已经把问题说的差不多了,就是在apache的 httpd.conf文件中添加

#添加mod_wsgi.so 模块

LoadModule wsgi_module modules/mod_wsgi.so

#工程中的wsgi文件

WSGIScriptAlias / E:/wamp/Apache24/www/www/wsgi.py

<Directory E:/wamp/Apache24/www>

Options FollowSymlinks

AllowOverride none

Require all granted

</Directory>

然后重启apache,果然解决问题了,原因我这里帮忙贴出来(大致是apache2.3后改动了访问目录权限的方式吧):

I found out thatmod_authz_corewas introduced in Apache2.3. This changes the way thataccesscontrol is declared from

Order allow, denyAllow from all

to :

Require all granted

This means that the total configuration for aDirectoryis now something like:

<Directory /path/to/directory>Options FollowSymlinksAllowOverride noneRequire all granted</Directory>

Restart apache and it'll all work nicely.

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航