403 Forbidden错误使用Django和mod_wsgi的 [英] 403 Forbidden error with Django and mod_wsgi

查看:334
本文介绍了403 Forbidden错误使用Django和mod_wsgi的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建Django项目的主目录,以便它在主目录。

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

设置

Django Verison  : 1.5.1
Python Version  : 2.7.5
mod_wsgi Version: 3.4
Home Directory  : /home/aettool

目录 /home/aettool/aet/apache/django.wsgi

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()

的httpd.conf 的客户服务联系

Contect of httpd.conf

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

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

错误 error_log中

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

目录 urls.py

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)),
)

775

Permissions of /home/aettool/aet : 775

/家庭/ aettool / AET的权限

的权限的/ home / aettool / AET /阿帕奇:755

django.wsgi文件的权限:664

我收到浏览器的误差 403禁止 您没有权限访问/在此服务器上。

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

请帮我出的配置。

修改

有关现在我改变前进

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

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

所以,这无疑是与的httpd.conf 文件的配置,但我担心的是我只加了5条线在该文件中,并不能弄清楚什么是错的。

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 .

推荐答案

显然,这是关系到Apache的2.4和旧版本的问题。
你需要在你的Apache配置来替换:

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

Require all granted

&LT;文件wsgi.py&GT; 部分

这篇关于403 Forbidden错误使用Django和mod_wsgi的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆