403 Django 和 mod_wsgi 的禁止错误 [英] 403 Forbidden error with Django and mod_wsgi

查看:33
本文介绍了403 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

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

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

httpd.conf

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

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

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

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

/home/aettool/aet 的权限:775

/home/aettool/aet/apache 的权限:755

django.wsgi 文件的权限:664

我在浏览器上遇到错误 403 Forbidden 您无权访问/在此服务器上.

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

请帮我进行配置.

编辑

现在我正在通过改变来前进

For now I am moving forward by changing

<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

部分

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

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