WikklyText A wikitext server and rendering library


Recently Edited
BehindApache edit
frank, 11 August 2008 (created 04 February 2008)
Tags: apache mod_python server
First, ensure you have installed the Python module. Running a WikklyText wiki behind Apache via mod_python is straightforward. Here I'll assume the wiki you want to serve is located in /MY/WIKI/PATH:
  • First, add a small bootstrap module to your wiki folder:
    cd /MY/WIKI/PATH
    wik makeboot
  • Point Apache to your wiki (i.e. inside a VirtualHost container):
    DocumentRoot "/MY/WIKI/PATH"
    LogLevel warn
    <Location />
        PythonPath "sys.path + [r'/MY/WIKI/PATH']"
        SetHandler python-program
        PythonHandler cherrypy._cpmodpy::handler
        PythonOption cherrypy.setup wikboot::start_modpython
        PythonDebug On
        # I recommend setting "MY_WIKI_NAME" in the next line
        # to give each wiki a unique name.
        # This avoids weird problems caused by mod_python caching.
        PythonInterpreter MY_WIKI_NAME
    </Location>

    If you use a Location other than /, edit wikboot.py (in your wiki folder) and set WEBPATH.
  • Restart Apache and your wiki should work.
  • For testing purposes, you can also run a standalone server:
    cd /MY/WIKI/PATH
    python wikboot.py


    You should be able to run a WikklyText server using FastCGI as well, but I haven't tried it myself.


Sessions


File-based sessions are probably your best option when running behind Apache. To set them up:
  • Go to Wiki Admin -> Server Configuration, and turn on file session storage. You probably want to set a large timeout value as well.
  • Often, Apache is set up to run as an unprivileged user. This can cause issues with WikklyText not being able to store sessions. The easiest way to set up sessions (assuming your wiki is stored in /home/MyWiki) is to do the following:
    $ mkdir -p /home/MyWiki/.wik/sessions
    $ chmod a+rxw /home/MyWiki/.wik/sessions


    Security Note
    If you are concerned about having a world-writeable directory, you can try changing the owner of the sessions directory to the user that runs the Apache process. The above just gives the simplest method. I'm personally not too concerned about having this world-writeable directory since WikklyText will not serve any files from the .wik directory. A malicious local user on a shared host could still manipulate the sessions directory, but that is true of many software installations on shared hosts.

    If anyone has a better suggestion for securing the sessions directory, please post it to the MailingList.
blog comments powered by Disqus