Skip to content

Configuring For Apache

swannodette edited this page Sep 13, 2010 · 10 revisions

You will need to install mod_wsgi. Once you decided where shiftspace will live, your Apache configuration file for your site will look something like this:

# change this point to where your python libraries live (site-packages/dist-packages)
WSGIPythonPath /path/to/site-packages

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        # where you'll be serving static files from
        DocumentRoot /var/www/static
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/static>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        # where you'll put your script that creates the ShiftSpace wsgi application
        WSGIScriptAlias /shiftspace /path/to/server.py

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

server.py should look something like the following:

import os
import server.server # load the actual ShiftSpace server.py module

ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
application = server.server.startWsgi(siteConf=os.path.join(ROOT_PATH, 'site.conf'))

Make sure that you have all of the ShiftSpace dependencies installed.

Make sure that shiftspace/server/sessions has the proper permissions so that session data can be written to that directory. If you would like sessions to be handled differently you’ll need to refer to the CherryPy sessions documentation.

chown -R www-data:www-data sessions

It’s important that couchdb-lucene be able to write to the directory where it keeps it indexes. The best thing to do is explicitly define the path where you want the indexes to live in your couchdb local.ini configuration file:

; CouchDB Configuration Settings                                                                                                                                                                          

; Custom settings should be made in this file. They will override settings                                                                                                                                
; in default.ini, but unlike changes made to default.ini, this file won't be                                                                                                                              
; overwritten on server upgrade.                                                                                                                                                                          

[couchdb]
;max_document_size = 4294967296 ; bytes                                                                                                                                                                   
os_process_timeout=60000 ; 60 seconds for couchdb-lucene                                                                                                                                                  

[httpd]
;port = 5984                                                                                                                                                                                              
;bind_address = 127.0.0.1                                                                                                                                                                                 

[log]
;level = debug                                                                                                                                                                                            

[update_notification]                                                                                                                                            
indexer=/path/to/java -Dcouchdb.lucene.dir=/path/to/indexes -jar /path/to/couchdb-lucene-0.4-jar-with-dependencies.jar -index

; To create an admin account uncomment the '[admins]' section below and add a                                                                                                                             
; line in the format 'username = password'. When you next start CouchDB, it                                                                                                                               
; will change the password to a hash (so that your passwords don't linger                                                                                                                                 
; around in plain-text files). You can add more admin accounts with more                                                                                                                                  
; 'username = password' lines. Don't forget to restart CouchDB after                                                                                                                                      
; changing this.                                                                                                                                                                                          
;[admins]                                                                                                                                                                                                 
;admin = mysecretpassword                                                                                                                                                                                 

[external]
; CHANGE THIS LINE, username should be set to your username                                                                                                                                               
fti=/path/to/java -Dcouchdb.lucene.dir=/path/to/indexes -jar /path/to/couchdb-lucene-0.4-jar-with-dependencies.jar -search

[httpd_db_handlers]
_fti={couch_httpd_external, handle_external_req, <<"fti">>}

And make sure couchdb can write to the indexes directory:

chown -R couchdb:couchdb /path/to/indexes
chmod -R 0770 /path/to/indexes
Clone this wiki locally