zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    js获取当前时间,日期格式为年月日
    create-react-app里添加less
    react css 模块化
    react 点击父级元素 不触发子级元素click事件
    react-router-dom 实现路由左右滑动进入页面的效果
    vue路由左右侧滑动 react路由左右侧滑动
    react 父组件不能直接在子组件上加className,也得用props传递过去
    react 父组件调用子组件方法
    css滚动相关问题记录
    javascript异步编程的几种方法
  • 原文地址:https://www.cnblogs.com/CQ-LQJ/p/4931086.html
Copyright © 2011-2022 走看看