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

前言: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 that mod_authz_core was introduced in Apache2.3. This changes the way that access control is declared from

  Order allow, deny
  Allow from all

to :

  Require all granted

This means that the total configuration for a Directory is now something like:

  <Directory /path/to/directory>
    Options FollowSymlinks
    AllowOverride none
    Require all granted
  </Directory> 

Restart apache and it'll all work nicely.

 

转载于:https://www.cnblogs.com/CQ-LQJ/p/4931086.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值