Flask + mod_wsgi: client denied by server configuration


I've been trying out quite a many things to the level of high frustration when trying to get Flask run with Apache + mod_wsgi.

Basically I've done the following tutorials:

http://flask.pocoo.org/docs/deploying/mod_wsgi/#installing-mod-wsgi http://www.lonesomedev.com/?p=169

But on browser I'm getting the following error:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

And in Apache error.log the following:

[Fri May 03 17:17:06 2013] [error] [client ::1] client denied by server configuration: /home/user1/Develop/flask_dbadmin.wsgi

I'm running OpenSuse 11.4.

5/3/2013 4:44:03 PM

Accepted Answer

It sounds like Apache doesn't have access to the object in question. Make sure you have an account set up for this specific reason and give the files access this account. Then use chown to set the access to these files for that user. In a development environment that can be for example the Apache account.

chown -R wwwrun:www /home/user1/Develop/

Or you could give everyone access, but I wouldn't recommend this.

chmod 777 -R /home/user1/Develop/

If that doesn't work you may need to manually allow access to the wsgi files in your apache config.

It should look something like this.

WSGIDaemonProcess flask_dbadmin user=wwwrun group=www threads=5
<VirtualHost *:80>


   <Directory /home/user1/Develop/ >
       Order allow,deny
       Allow from all

   <Files flask_dbadmin.wsgi>
       Order allow,deny
       Allow from all
5/4/2013 2:02:19 AM

If you tried things mentioned Apache2: 'AH01630: client denied by server configuration' here and it still doesn't work chances are your wsgi script alias path is outside path mentioned in <Directory> block.

You need a <Directory> or <Location> block for every Alias. So for example,

for WSGIScriptAlias / /home/stark/FlaskApp/flaskapp.wsgi

you would need

 <Directory /home/stark/FlaskApp>
       Require all granted

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow