Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 311
Jussi Avatar asked May 03 '13 15:05

Jussi


2 Answers

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
 </Directory>
like image 194
Scientist1642 Avatar answered Sep 21 '22 13:09

Scientist1642


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
    </Directory>

   <Files flask_dbadmin.wsgi>
       Order allow,deny
       Allow from all
   </Files>
</VirtualHost>
like image 25
eandersson Avatar answered Sep 20 '22 13:09

eandersson