mercredi 9 avril 2014

python - Apache | Django | mod_wsgi | Erreur Forbidden 403 - Stack Overflow


Django Verison : 1.5.1


Python Version : 2.7.5


mod_wsgi Version: 3.4


Home Directory: /home/aettool


I created Django project in home directory so it is in home directory.


Contents of /home/aettool/aet/apache/django.wsgi


import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'aet.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Contect of httpd.conf


WSGIScriptAlias / /home/aettool/aet/apache/django.wsgi

<Directory /home/aettool/aet/apache>
Order deny,allow
Allow from all
</Directory>

Error in error_log


[Sun Jul 21 02:01:30.923364 2013] [authz_core:error] [pid 21540:tid 1193011520] [client 10.20.17.184:51340] AH01630: client denied by server configuration: /home/aettool/aet/apache/django.wsgi

Contents of urls.py


from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
)

Permissions of /home/aettool/aet : 775


Permissions of /home/aettool/aet/apache : 755


Permissions of django.wsgi file : 664


I am getting error on browser 403 Forbidden You don't have permission to access / on this server.


Please help me out with the configuration .


EDIT


For now I am moving forward by changing


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

to


<Directory />
Order deny,allow
Allow from all
</Directory>

So,this has definitely something to do with httpd.conf file configuration,but my worry is that I only added 5 lines in that file and not able to figure out what's wrong .




Apparently this is an issue that is related to Apache 2.4 and older versions. You need to replace in your apache configuration:


Allow from all

with


Require all granted

in the <Files wsgi.py> section




You can use the following:


<Directory /home/aettool/aet/apache>
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>


Django Verison : 1.5.1


Python Version : 2.7.5


mod_wsgi Version: 3.4


Home Directory: /home/aettool


I created Django project in home directory so it is in home directory.


Contents of /home/aettool/aet/apache/django.wsgi


import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'aet.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Contect of httpd.conf


WSGIScriptAlias / /home/aettool/aet/apache/django.wsgi

<Directory /home/aettool/aet/apache>
Order deny,allow
Allow from all
</Directory>

Error in error_log


[Sun Jul 21 02:01:30.923364 2013] [authz_core:error] [pid 21540:tid 1193011520] [client 10.20.17.184:51340] AH01630: client denied by server configuration: /home/aettool/aet/apache/django.wsgi

Contents of urls.py


from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
)

Permissions of /home/aettool/aet : 775


Permissions of /home/aettool/aet/apache : 755


Permissions of django.wsgi file : 664


I am getting error on browser 403 Forbidden You don't have permission to access / on this server.


Please help me out with the configuration .


EDIT


For now I am moving forward by changing


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

to


<Directory />
Order deny,allow
Allow from all
</Directory>

So,this has definitely something to do with httpd.conf file configuration,but my worry is that I only added 5 lines in that file and not able to figure out what's wrong .



Apparently this is an issue that is related to Apache 2.4 and older versions. You need to replace in your apache configuration:


Allow from all

with


Require all granted

in the <Files wsgi.py> section



You can use the following:


<Directory /home/aettool/aet/apache>
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>

0 commentaires:

Enregistrer un commentaire