Linux中的Apache服务器错误禁止访问

时间:2016-06-09 17:16:59

标签: python django apache web wsgi

我是网络开发的初学者。当我运行Apache服务器时,在网页中给我这个错误:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.20 (Unix) mod_wsgi/4.4.22 Python/2.7.11 

我正在使用Django 1.9.1 Web应用程序开发并使用带有apache版本2的mode_wsgi。这是我的wsgi.py文件:

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "newSite.settings")

application = get_wsgi_application()

和我的httpd.conf:

WSGIScriptAlias /newsite "/home/hello/django/newSite/newSite/wsgi.py"
WSGIPythonPath "/home/hello/django/newSite"

<Directory "/home/hello/django/newSite/newSite/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>

1 个答案:

答案 0 :(得分:0)

谢谢你们,&#39;
我成功地真正运行了服务器 只需将目标目录权限更改为775,并将httpd.conf中的用户和组更改为我当前的用户 对于网站root的自定义文件夹,请更改&#34; DocumentRoot&#34; httpd.conf和设置权限。


我的英语 再次感谢