Reputation: 746
I had problems deploying a Django project - Review Board. I did what the document says and but got "Error 403" errors when I tried visiting the site. Maybe I should have posted this question on serverfault.com, but I think this may help people write/deploy Django application in general.
Here is the installation:
I installed Review Board in /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
All files have read permission for the httpd user and the database and the uploaded
directory have write permission for the httpd user.
The content of conf/apache-modpython.conf
is:
<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>
I also cited this file in the main Apache configuration file, /etc/httpd/conf/httpd.conf
like this:
Include /data/www/reviewboard/conf/apache-modpython.conf
When I tried to access the site by http://A.B.C.edu/rb
, I got 403 error and saw this message in httpd error log:
[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
Does anybody know what I did wrong? Thanks in advance!
Upvotes: 1
Views: 1531
Reputation: 746
Found the answer from the author of Review Board. The trick is to add
Options FollowSymlinks
in the <Location>
tag that points to the media
directory, because that directory contains symbolic links.
More detail is in this post:
http://groups.google.com/group/reviewboard/browse_thread/thread/6fac4d0041237f15/
Upvotes: 1
Reputation: 947
You need to grant access to /data/www/reviewboard/htdocs
<Directory "/data/www/reviewboard/htdocs">
Order allow,deny
Allow from *
AllowOverride All
</Directory>
Upvotes: 1