Solution to 403 Forbidden error when deploying django in Apache2.4: apache2.4django

Source: Internet
Author: User
Tags 403 forbidden error

Solution to 403 Forbidden error when deploying django in Apache2.4: apache2.4django

Apache2.4 deploy django with the 403 Forbidden error. It is best to check the error log in apache to see which causes the 403 error.

In the afternoon, Baidu failed to find a solution for one afternoon. He tried n methods, which is just a pitfall!

For example, the most common solution for Web pages is:

<Directory E:/wamp/Apache24/www (your project path)>
Order allow, deny
Allow from all
</Directory>

It's a pity that after this change, I still reported 403, and finally remembered to check err. log 1 Reports client denied by server configuration: E:/wamp/Apache24/www/wsgi. py, at that time, all kinds of vomiting blood. Later, I found a webpage in the open-source community to find a solution.

Solution URL: https://mikegriffin.ie/blog/20140130-authz-core-error-client-denied-by-server-configuration/

 

Body: In fact, I have mentioned the problem about it before, that is, to add it to the httpd. conf file of apache.

 

# Add mod_wsgi.so Module
LoadModule wsgi_module modules/mod_wsgi.so

# Wsgi files in the project

 

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

 

<Directory E:/wamp/Apache24/www>
Options FollowSymlinks
AllowOverride none
Require all granted
</Directory>

Then restart apache to solve the problem. I am here to help paste it out (probably after apache2.3, I changed the access directory permission method ):

I found out thatmod_authz_coreWas 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 forDirectoryIs now something like:

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

Restart apache and it all work nicely.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.