403 Forbidden in Apache

147 views
Skip to first unread message

James

unread,
Jun 11, 2008, 12:26:14 PM6/11/08
to reviewboard
Hello,



I am looking forward to trying out reviewboard. It seems like
something that could be very useful. Unfortunately, I am unable to
access the program from Apache and am pretty much stuck on what to do
next.



I have successfully installed all the pre-reqs on our RedHat AS4
server.

Python 2.5.2

Pysqlite-2.4.1

Django 0.97 (from yesterday’s SVN HEAD)

Sqlite-amalgamation-3.5.9

Imaging-1.1.6

Apache 2.2

mod_python-3.3.1

patchutils-0.2.31



I updated settings_local.py to use sqlite3

And ran ./manage.py syncdb without problems:
bash-3.00# ./manage.py syncdb
Installing json fixture 'initial_data' from '/opt/reviewboard/scmtools/
fixtures'.
Installed 6 object(s) from 1 fixture(s)

I configured apache using the example http.conf entry as follows:
<VirtualHost *:80>
ServerName ussy-vm-matrix01.sjm.com
DocumentRoot /opt/reviewboard/htdocs

# Error handlers
ErrorDocument 500 /errordocs/500.html

# Serve django pages
<LocationMatch ^/(.*)$>
PythonPath "['@djangodir@'] + ['@pythondir@/
reviewboard'] + ['@pythondir@/djblets'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonAutoReload Off
PythonDebug Off
# If you run multiple mod_python sites in the same
apache
# instonce, uncomment this line:
# PythonInterpreter reviewboard
</LocationMatch>

# Serve static media without running it through mod_python
# (overrides the above)
<LocationMatch ^(/(media|errordocs))>
SetHandler None
</LocationMatch>

# Alias static media requests to filesystem
Alias /media /opt/reviewboard/htdocs/media
Alias /errordocs /opt/reviewboard/htdocs/errordocs
</VirtualHost>


When I start Apache I get a message (not sure if this has an impact on
reviewboard):

httpd: Could not reliably determine the server's fully qualified
domain name, using 10.16.4.90 for ServerName



When I try to navigate to the webserver, I get a response, but it is a
403 Forbidden. This makes sense because I do not have directory index
enabled and /opt/reviewboard/htdocs does not have an index.html or
anything of that nature.

bash-3.00# ls -l /opt/reviewboard/htdocs/

total 20

drwxr-xr-x 3 root root 4096 Jun 10 17:06 errordocs

-rw-r--r-- 1 root root 12184 Jun 10 17:06 Makefile.am

drwxr-xr-x 9 root root 4096 Jun 10 17:07 media



Am I doing something inherently wrong?



Below are some of the Apache logs too, but everything seems normal.



error_log

[Wed Jun 11 09:15:52 2008] [notice] mod_python: Creating 8 session
mutexes based on 256 max processes and 0 max threads.

[Wed Jun 11 09:15:52 2008] [notice] mod_python: using mutex_directory /
tmp

[Wed Jun 11 09:15:52 2008] [notice] Apache/2.2.8 (Unix) mod_python/
3.3.1 Python/2.5.2 configured -- resuming normal operations

[Wed Jun 11 09:16:22 2008] [error] [client 150.202.99.26] client
denied by server configuration: /opt/reviewboard/htdocs/



access_log

150.202.99.26 - - [11/Jun/2008:09:01:47 -0700] "GET / HTTP/1.1" 403
202

150.202.99.26 - - [11/Jun/2008:09:16:22 -0700] "GET / HTTP/1.1" 403
202



PS. When I run the selftests of PIL, it seems like the jpeg component
is not working. Is this piece of PIL needed by reviewboard?



bash-3.00# python selftest.py

*****************************************************************

Failure in example: _info(Image.open("Images/lena.jpg"))

from line #24 of selftest.testimage

Exception raised:

Traceback (most recent call last):

File "./doctest.py", line 499, in _run_examples_inner

exec compile(source, "<string>", "single") in globs

File "<string>", line 1, in <module>

File "./selftest.py", line 22, in _info

im.load()

File "PIL/ImageFile.py", line 180, in load

d = Image._getdecoder(self.mode, d, a, self.decoderconfig)

File "PIL/Image.py", line 375, in _getdecoder

raise IOError("decoder %s not available" % decoder_name)

IOError: decoder jpeg not available

1 items had failures:

1 of 57 in selftest.testimage

***Test Failed*** 1 failures.

*** 1 tests of 57 failed.

Mat Schaffer

unread,
Jun 11, 2008, 12:58:47 PM6/11/08
to revie...@googlegroups.com
First, you know you have to replace those things between @@'s right?
They're placeholders for what the actual directories need to be. You
can also use the following to try to build it, but that didn't guess
the proper folders in my case:

cd /opt/reviewboard
./autogen.sh
cd contrib
make

Also do you have a Directory entry somewhere for /opt/reviewboard/
htdocs or one of it's parents? If not, you may need one and throw
Allow from all in it.
-Mat

On Jun 11, 2008, at 12:26 PM, James wrote:
> I am looking forward to trying out reviewboard. It seems like
> something that could be very useful. Unfortunately, I am unable to
> access the program from Apache and am pretty much stuck on what to do
> next.
>

Leone, James

unread,
Jun 11, 2008, 3:31:54 PM6/11/08
to revie...@googlegroups.com
Mat,

I added the Directory listing as you mentioned and now I am getting
somewhere.

When I access this site I get "Review Board is taking a nap" page.

What does this indicate?

Leone, James

unread,
Jun 11, 2008, 3:36:53 PM6/11/08
to revie...@googlegroups.com

Mat,

 

This is the error log.  I have also pasted my /opt/reviewboard/settings_local.py below

 

[Wed Jun 11 12:34:33 2008] [notice] mod_python: Creating 8 session mutexes based on 256 max processes and 0 max threads.

[Wed Jun 11 12:34:33 2008] [notice] mod_python: using mutex_directory /tmp

[Wed Jun 11 12:34:33 2008] [notice] Apache/2.2.8 (Unix) mod_python/3.3.1 Python/2.5.2 configured -- resuming normal operations

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] mod_python (pid=29267, interpreter='ussy-vm-matrix01.sjm.com', phase='PythonHandler', handler='django.core.handlers.modpython'): Application error

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] ServerName: 'ussy-vm-matrix01.sjm.com'

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] DocumentRoot: '/opt/reviewboard/htdocs'

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] URI: '/'

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] Location: '/'

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] Directory: None

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] Filename: '/opt/reviewboard/htdocs/'

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] PathInfo: ''

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] Traceback (most recent call last):

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch\n    default=default_handler, arg=req, silent=hlist.silent)

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target\n    result = _execute_target(config, req, object, arg)

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target\n    result = object(arg)

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/django/core/handlers/modpython.py", line 189, in handler\n    return ModPythonHandler()(req)

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/django/core/handlers/modpython.py", line 153, in __call__\n    self.load_middleware()

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py", line 27, in load_middleware\n    for middleware_path in settings.MIDDLEWARE_CLASSES:

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/django/conf/__init__.py", line 28, in __getattr__\n    self._import_settings()

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/django/conf/__init__.py", line 59, in _import_settings\n    self._target = Settings(settings_module)

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/django/conf/__init__.py", line 85, in __init__\n    mod = __import__(self.SETTINGS_MODULE, {}, {}, [''])

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/reviewboard/settings.py", line 180, in <module>\n    dependency_error('Unable to read settings_local.py.')

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26]   File "/usr/local/lib/python2.5/site-packages/reviewboard/settings.py", line 169, in dependency_error\n    sys.exit(1)

[Wed Jun 11 12:34:47 2008] [error] [client 150.202.99.26] SystemExit: 1

 

# Database backend.  Any supported django database engine should work.

DATABASE_ENGINE = 'sqlite3'      # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.

DATABASE_NAME = 'reviewboard.sqlite'  # Or path to database file if using sqlite3.

DATABASE_USER = '********'     # Not used with sqlite3.

DATABASE_PASSWORD = '********' # Not used with sqlite3.

DATABASE_HOST = ''             # Set to empty string for localhost.

DATABASE_PORT = ''             # Set to empty string for default.

 

# Make this unique, and don't share it with anybody.

SECRET_KEY = 'secretkey'

 

# Cache backend.  Unset this to turn off caching completely.  As with most

# django installations, the best option is probably to use memcached.

CACHE_BACKEND = 'locmem:///'

 

# Whether to send e-mail for review requests.

SEND_REVIEW_MAIL = False

 

# Local time zone for this installation. All choices can be found here:

# http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE

TIME_ZONE = 'US/Pacific'

 

# Language code for this installation. All choices can be found here:

# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes

# http://blogs.law.harvard.edu/tech/stories/storyReader$15

LANGUAGE_CODE = 'en-us'

 

# This should match the ID of the Site object in the database.  This is used to

# figure out URLs to stick in e-mails and related pages.

SITE_ID = 1

 

# If you set this to False, Django will make some optimizations so as not

# to load the internationalization machinery.

USE_I18N = True

 

# Enable search.  Search needs PyLucene to be installed.  It also requires

# that a regular job be set up to perform the indexing.  To generate the

# index, run:

#    manage.py index

# This command will perform an incremental index.  To do a full reindex, run:

#    manage.py index --full

#

# Incremental indexes should be done fairly often.

# A sample cron configuration exists in contrib/conf/search-cron.conf

#

# If you want the search index to be located somewhere other than the

# reviewboard root, set SEARCH_INDEX to the desired path.  The index needs to be

# a directory writable by the user creating the index and readable by the user

# that Review Board runs as.

ENABLE_SEARCH = False

Paul Beets

unread,
Jun 11, 2008, 3:47:21 PM6/11/08
to revie...@googlegroups.com
Looks to me like it doesn't know where the reviewboard directory is located.
--
Paul J. Beets XXX WWW
Eagle Scout - Boy Scout Troop 337 Rossville, IN
Crew Advisor - Venture Crew 54 Novi, MI
Scoutmaster - Boy Scout Troop 54 Novi, MI
Activities & Civic Service Committee Chair
Ottawa District, Clinton Valley Council
Boy Scouts of America

Leone, James

unread,
Jun 11, 2008, 4:29:49 PM6/11/08
to revie...@googlegroups.com

Paul,

 

How is this determined?  Did I missing a step during build configuration? 

 

I know minimal about the Python language.  I examined /usr/local/lib/python2.5/site-packages/reviewboard/settings.py and didn’t find a clear answer.  I see REVIEWBOARD_ROOT = os.path.abspath(os.path.split(__file__)[0]) but have no idea the context behind __file__

 


Mat Schaffer

unread,
Jun 11, 2008, 4:39:20 PM6/11/08
to revie...@googlegroups.com
Leone, did you also update the @@'s in the apache config like I talked about?

It looks like reviewboard can't find it's settings_local.py which would indicate that /usr/local/lib/python2.5/site-packages/reviewboard isn't in your path (or might not even exist).

Like I said that template didn't work 100% for me.  So feel free to fiddle with that path line in apache as needed.

You may also want to consider fastcgi if you have any plans on using search.  I ended up going that route after finding out that pylucene doesn't play nice with mod_python.

-Mat

Paul Beets

unread,
Jun 11, 2008, 4:44:06 PM6/11/08
to revie...@googlegroups.com
Leone,

I'm not an expert by any means with python either.

The tutorial on the wiki shows that you need to make sure your httpd.conf file sets certain information into environmental variables that are used to find django and it's projects

This is pretty much what my httpd.conf file looks like. It works for us.

Change YourServerName to the name of the server you are using
Change YourUserName to the name of the user who's home you are storing reviewboard under. It doesn't have to be stored there and probably isn't the best idea but that is what we are doing and it is working well.


<VirtualHost *:80>
        ServerName YourServerName
        DocumentRoot /home/YourUserName/Web/django_projects/reviewboard/htdocs


        # Error handlers
        ErrorDocument 500 /errordocs/500.html

        # Serve django pages
        <LocationMatch ^/(.*)$>
                PythonPath "['@djangodir@'] + ['/home/YourUserName/Web/django_projects'] +['/home/YourUserName/Web/django_projects/reviewboard'] +  ['@pythondir@/djblets'] + sys.path"
                SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
                SetEnv P4PORT xx.xx.xx.xx:xxxx

                SetHandler mod_python
                PythonHandler django.core.handlers.modpython
                PythonAutoReload Off
                PythonDebug Off
                # If you run multiple mod_python sites in the same apache
                # instonce, uncomment this line:
                # PythonInterpreter reviewboard
        </LocationMatch>

        # Serve static media without running it through mod_python
        # (overrides the above)
        <LocationMatch ^(/(media|errordocs))>
                SetHandler None
        </LocationMatch>

        # Alias static media requests to filesystem
        Alias /media /home/YourUserName/Web/django_projects/reviewboard/htdocs/media
        Alias /errordocs /home/YourUserName/Web/django_projects/reviewboard/htdocs/errordocs
</VirtualHost>

Leone, James

unread,
Jun 11, 2008, 8:42:59 PM6/11/08
to revie...@googlegroups.com

Step by step I am getting there.

 

@pythondir@ didn’t mean much to me, but after the examples, I realized you wanted the directory where the python site-packages where located.

Likewise for @djangodir@

 

After setting that up, I noticed that settings_local.py was not getting copied to @pythondir@ so I manually copied it and the reviewboard.sqlite file to /usr/local/lib/python2.5/site-packages/reviewboard

 

Then I got an error about django-evolution module not being found.  So I downloaded and installed that.

 

Now I get the following error:

 

OperationalError: attempt to write a readonly database

 

I am using a sqlite database.  I noticed that every time I “chmod +w /opt/reviewboard/reviewboard.sqlite”  the permissions are reset when I access the webpage.

 

Any thoughts on this?

 

PS. I will send a summary of what I needed to do that the Getting Started didn’t cover once I get started.

 

 


From: revie...@googlegroups.com [mailto:revie...@googlegroups.com] On Behalf Of Paul Beets
Sent: Wednesday, June 11, 2008 1:44 PM
To: revie...@googlegroups.com
Subject: Re: 403 Forbidden in Apache

 

Leone,

Mat Schaffer

unread,
Jun 11, 2008, 9:14:43 PM6/11/08
to revie...@googlegroups.com
On Jun 11, 2008, at 8:42 PM, Leone, James wrote:
After setting that up, I noticed that settings_local.py was not getting copied to @pythondir@ so I manually copied it and the reviewboard.sqlite file to /usr/local/lib/python2.5/site-packages/reviewboard

I would recommend that you point apache at the right location rather than copying individual files around.  I'm sure reviewboard was not designed to be located in various places throughout the file system.  Keep all the files together with the possible exception of the contrib/conf/apache-modpython.conf.  Modify that to tell apache where to find what it needs.


Since reviewboard is really just a django project, all of this documentation should apply to your situation.

Good luck,
Mat

Leone, James

unread,
Jun 12, 2008, 2:05:52 PM6/12/08
to revie...@googlegroups.com

Mat,

 

Ultimately, I want to get this thing running.  I don’t care if I use Apache, Windows, Linux, whatever.  Is there a document that accurately describes the install procedure?

 

James


From: revie...@googlegroups.com [mailto:revie...@googlegroups.com] On Behalf Of Mat Schaffer
Sent: Wednesday, June 11, 2008 6:15 PM
To: revie...@googlegroups.com
Subject: Re: 403 Forbidden in Apache

 

On Jun 11, 2008, at 8:42 PM, Leone, James wrote:

Reply all
Reply to author
Forward
0 new messages