apache + wsgi + django : Client denied by server configuration

I’m getting a 403 error with my django project.

The only line I get in my error log is :

AH01630: client denied by server configuration: /srv/http/www/src/myproject/preprod_wsgi.py

The permissions for this file are :

-rwxr-xr-x 1 root root  552 Jul 30 04:24 preprod_wsgi.py

And the apache (VERSION : 2.4) conf file contains (amongst other things) :

LoadModule wsgi_module modules/mod_wsgi.so

<IfModule unixd_module>
    User http
    Group http
</IfModule>

<Directory />
    AllowOverride none
    Require all denied
</Directory>

#
# Others
#

Alias /robots.txt /srv/http/www/htdocs/static/robots.txt
Alias /favicon.ico /srv/http/www/htdocs/static/favicon.ico


Alias /media/ /srv/http/www/htdocs/media/
Alias /static/ /srv/http/www/htdocs/static/


<Directory "/srv/http/www/htdocs/static">
           Require all granted
</Directory>

<Directory "/srv/http/www/htdocs/media">
           Require all granted
</Directory>

<Files "/srv/http/www/src/myproject/preprod_wsgi.py">
       Require all granted
</Files>

#
# WSGI
#

WSGIDaemonProcess myproject python-path=/srv/http/www/src
WSGIScriptAlias / /srv/http/www/src/myproject/preprod_wsgi.py
WSGIPythonPath /srv/http/www/src

DocumentRoot "/srv/http/www/htdocs"
<Directory "/srv/http/www/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

ErrorLog "/srv/http/www/logs/error_log"
CustomLog "/srv/http/www/logs/access_log" common

LogLevel warn

Here is also the content of my preprod_wsgi.py file :

"""
WSGI config for soisbault project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""

import os, sys

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.preprod_settings")

application = get_wsgi_application()

I tried to add access to this file with <Files> directive, and did a chmod 755 on it. But I can’t figure out what I could do more.

How could I fix this? Feel free to ask more details if necessary.

Thank you in advance.


Source: apache

Leave a Reply