If you're running Apache 1.3 (or an httpd based on Apache 1.3, such as OpenBSD's httpd), it's still possible to get MoinMoin working under WSGI. It will take some additional steps. These instructions assume you have root (superuser) privileges on the wiki server, and a dedicated virtual host name that you will use for your wiki (e.g. mywiki.your.domain).

Before we start, you should take note of your wiki directory (something like /var/www/moin/mywiki) and your wiki user (something like www or www-data -- whatever account owns the wiki directory and its content).

  1. Install CherryPy on the wiki server.

  2. Copy moin.wsgi from the wiki/server/ subdirectory of the source tree into your wiki directory. Edit it:

       1 #!/usr/bin/env python
       2 # -*- coding: iso-8859-1 -*-
       3 """
       4     MoinMoin - mod_wsgi driver script
       5     ...
       6 """
       7 
       8 from MoinMoin.server.server_wsgi import WsgiConfig, moinmoinApp
       9 from cherrypy.wsgiserver import CherryPyWSGIServer, WSGIPathInfoDispatcher
      10 
      11 class Config(WsgiConfig):
      12     pass
      13 
      14 config = Config()
      15 
      16 application = moinmoinApp
      17 
      18 def run_cherrypy(app, address='', port=8080):
      19     from cherrypy import wsgiserver
      20     d = WSGIPathInfoDispatcher({'/': app})
      21     server = CherryPyWSGIServer((address, port), d,
      22                                 server_name='mywiki.your.domain')
      23     try:
      24         server.start()
      25     except KeyboardInterrupt:
      26         server.stop()
      27 
      28 run_cherrypy(application, '0.0.0.0', 8080)
    

    Change the server_name= part and the port number, if you want. You may use any port number greater than 1023 that's not already being used by something else. (We'll be running this program as an unprivileged user, so we can't use ports under 1024.) Give it execute permissions with a chmod 755 moin.wsgi command.

  3. Arrange for the moin.wsgi program to be run as your wiki user, inside the wiki directory, according to whatever techniques you use on your system for boot scripts or the like. Start it running now. You should see it listening on port 8080 (or whatever you set in the moin.wsgi file).

  4. Edit your Apache configuration (httpd.conf or whatever filename is correct for your system):

    ...
    Alias /moin_static183/ "/usr/local/share/moin/htdocs/"
    ...
    NameVirtualHost *:80
    ...
    <VirtualHost *:80>
    ServerName mywiki.your.domain
    ServerAdmin [email protected]
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/moin_static.../
    RewriteRule ^/(.*) http://127.0.0.1:8080/$1 [P]
    ProxyRequests Off
    ProxyPassReverse / http://127.0.0.1:8080/
    ErrorLog /var/www/logs/mywiki.your.domain-error.log
    CustomLog /var/www/logs/mywiki.your.domain-access.log combined
    </VirtualHost>

    Obviously, you should change the htdocs location, the port number, and the logfile locations as necessary.

    The moin_static183 in the Alias should be changed for each version of MoinMoin. The moin_static... part in the RewriteCond is a regular expression, so it will match every version, and doesn't need adjustment. The purpose of the rewriting code here is to allow the Alias to work for the static content URLs, and rewrite (proxy) everything else to the CherryPy service. Reload or restart your Apache so that it picks up the changes.

That's basically all. Your wiki should be visible at http://mywiki.your.domain/ now. Test everything and make sure it seems correct.