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_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 forDirectory
Is now something like:
<Directory /path/to/directory> Options FollowSymlinks AllowOverride none Require all granted </Directory>
Restart apache and it all work nicely.