我在部署Django项目时遇到了问题 - 审核委员会。我做了文档所说的内容,但在我尝试访问该网站时出现了“Error 403”错误。也许我应该在serverfault.com上发布这个问题,但我认为这可能有助于人们编写/部署Django应用程序。
以下是安装:
我在/data/www/reviewboard
中安装了审核委员会:
. |-- conf | |-- apache-modpython.conf | |-- search-cron.conf | `-- settings_local.py |-- db | `-- reviewboard.db |-- htdocs | |-- errordocs -> /usr/lib/python2.6/site-packages/ReviewBoard-1.0.8-py2.6.egg/reviewboard/htdocs/errordocs | |-- media | | |-- admin -> /usr/lib/python2.6/site-packages/ReviewBoard-1.0.8-py2.6.egg/reviewboard/htdocs/media/admin | | |-- djblets -> /usr/lib/python2.6/site-packages/Djblets-0.6.2-py2.6.egg/djblets/media | | |-- rb -> /usr/lib/python2.6/site-packages/ReviewBoard-1.0.8-py2.6.egg/reviewboard/htdocs/media/rb | | `-- uploaded | | `-- images | `-- rb | |-- errordocs -> ../errordocs/ | `-- media -> ../media/ |-- logs `-- tmp
所有文件都具有httpd用户和数据库的读取权限,uploaded
目录具有httpd用户的写入权限。
conf/apache-modpython.conf
的内容是:
<VirtualHost *:80>
ServerName A.B.C.edu
DocumentRoot "/data/www/reviewboard/htdocs"
# Error handlers
ErrorDocument 500 /errordocs/500.html
# Serve django pages
<Location "/rb">
PythonPath "['/data/www/reviewboard/conf'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
SetEnv PYTHON_EGG_CACHE "/data/www/reviewboard/tmp/egg_cache"
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonAutoReload Off
PythonDebug Off
# Used to run multiple mod_python sites in the same apache
PythonInterpreter reviewboard_reviewboard
</Location>
# Serve static media without running it through mod_python
# (overrides the above)
<Location "/media">
SetHandler None
</Location>
<Location "/errordocs">
SetHandler None
</Location>
<Directory "/data/www/reviewboard/htdocs">
AllowOverride All
</Directory>
# Alias static media requests to filesystem
Alias /media /data/www/reviewboard/htdocs/media
Alias /errordocs /data/www/reviewboard/htdocs/errordocs
</VirtualHost>
<VirtualHost *:80>
ServerName A.B.C.edu
DocumentRoot "/data/www/reviewboard/htdocs"
# Error handlers
ErrorDocument 500 /errordocs/500.html
# Serve django pages
<Location "/rb">
PythonPath "['/data/www/reviewboard/conf'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
SetEnv PYTHON_EGG_CACHE "/data/www/reviewboard/tmp/egg_cache"
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonAutoReload Off
PythonDebug Off
# Used to run multiple mod_python sites in the same apache
PythonInterpreter reviewboard_reviewboard
</Location>
# Serve static media without running it through mod_python
# (overrides the above)
<Location "/media">
SetHandler None
</Location>
<Location "/errordocs">
SetHandler None
</Location>
<Directory "/data/www/reviewboard/htdocs">
AllowOverride All
</Directory>
# Alias static media requests to filesystem
Alias /media /data/www/reviewboard/htdocs/media
Alias /errordocs /data/www/reviewboard/htdocs/errordocs
</VirtualHost>
我还在主Apache配置文件中引用了这个文件,如下所示:
/etc/httpd/conf/httpd.conf
当我尝试通过
Include /data/www/reviewboard/conf/apache-modpython.conf
访问该网站时,出现403错误,并在httpd错误日志中看到此消息:
[Tue Jun 22 08:52:57 2010] [notice] Apache/2.2.11 (Mandriva Linux/PREFORK-10.1mdv2009.1) mod_python/3.3.1 Python/2.6.1 DAV/2 SVN/1.6.1 mod_ssl/2.2.11 OpenSSL/0.9.8k configured -- resuming normal operations [Tue Jun 22 08:53:30 2010] [error] [client X.X.X.X] client denied by server configuration: /data/www/reviewboard/htdocs/rb
有人知道我做错了什么吗?提前谢谢!
答案 0 :(得分:1)
您需要授予对/ data / www / reviewboard / htdocs
的访问权限<Directory "/data/www/reviewboard/htdocs">
Order allow,deny
Allow from *
AllowOverride All
</Directory>
答案 1 :(得分:1)
找到了审查委员会作者的答案。诀窍是添加
Options FollowSymlinks
<Location>
目录的media
标记中的,因为该目录包含符号链接。
这篇文章中有更多细节:
http://groups.google.com/group/reviewboard/browse_thread/thread/6fac4d0041237f15/