AH00112:警告 - Centos 6 / Apache 2.4 / Django 1.9 / mod_wsgi 3.5 / python 2.7

时间:2016-10-17 18:06:05

标签: python django apache python-2.7 mod-wsgi

我有一个GoDaddy专用服务器。我似乎已经成功地设置了一切,但我似乎无法弄清楚为什么我会遇到这个问题:

当我重新启动apache时:

[root@sXXX-XXX-XXX-XXX /]# /scripts/restartsrv httpd

我明白了:

AH00112: Warning: DocumentRoot [/usr/local/apache/var/www/<my_django_project>] does not exist
AH00112: Warning: DocumentRoot [/usr/local/apache/var/www/<my_django_project>] does not exist
AH00112: Warning: DocumentRoot [/usr/local/apache/var/www/<my_django_project>] does not exist

我从未指定过/usr/local/apache/var/www/<my_django_project> ???

的路径

似乎只是将var/www/<my_django_project>追加到/usr/local/apache ...不确定原因

我的httpd.conf文件:

... a bunch of pre configured goDaddy stuff I'm guessing here ...


LoadModule wsgi_module /usr/local/apache/extramodules/mod_wsgi.so
AddHandler wsgi-script .wsgi

<VirtualHost XXX.XXX.XXX.X:80>

ServerName XXX.XXX.XXX.XXX
ErrorLog /var/log/httpd/error.log
# DocumentRoot /public_html/
ServerAdmin admin-noreply@mysite.com

Alias /favicon.ico /var/www/<my_django_project>/static/favicon.ico

Alias /static /var/www/<my_django_project>/static
<Directory /var/www/<my_django_project>/static>
        Require all granted
</Directory>

Alias /media /var/www/<my_django_project>/media
<Directory /var/www/<my_django_project>/media>
        Require all granted
</Directory>

WSGIDaemonProcess <my_django_project> python-path= /var/www/<my_django_project>:/var/www/<my_django_project>/<my_django_project>:/var/www/<my_django_project>/<my_django_project_site>:/usr/local/lib/python2.7/site-packages
WSGIProcessGroup <my_django_project>
WSGIScriptAlias / /var/www/<my_django_project>/<my_django_project>/wsgi.py

<Directory /var/www/<my_django_project>/<my_django_project>>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

</VirtualHost>

... more stuff already in the conf file ...

当我在我的互联网浏览器中访问XXX-XXX-XXX-XXX:80时,它告诉我它无法找到.htaccess文件。但现在它只是将我重定向到http://XXX.XXX.XXX.XXX/cgi-sys/defaultwebpage.cgi

非常感谢任何帮助

编辑:

有人指出AH00112: Warning: DocumentRoot [/usr/local/apache/var/www/<my_django_project>] does not exist原因是未在路径前添加/

我的浏览器现在给了我:

Forbidden

You don't have permission to access / on this server.
Server unable to read htaccess file, denying access to be safe

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

1 个答案:

答案 0 :(得分:0)

这表示您已在Apache配置文件中的某处将DocumentRoot指令设置为没有前导斜杠的路径。发生这种情况时,Apache会将路径附加到ServerRoot目录末尾,在您的情况下为/usr/local/apache。确保您设置的所有文件系统路径都是具有前导斜杠的绝对路径名。