【发布时间】:2017-02-26 19:44:24
【问题描述】:
我有一个使用 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 ...
当我在 Internet 浏览器中转到 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是由于没有在path前面添加/造成的。
我的浏览器现在给了我:
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.
【问题讨论】:
-
这是通过python runserver命令还是这个命令有效?
-
@JC203 当我使用 python2.7 manage.py runserver 0:8000 它工作得很好。但 Apache 无法为网站提供服务器
标签: python django apache python-2.7 mod-wsgi