Here is a recipe for configuring Moin with CGI on Apache 2.0 with multiple wikis (i.e. a farm), without having the wikis mounted at the root of domains. This last bit is a touch tricky, and I could find no recipes for it, though I found some requests for such a recipe.

The wikis are to be at:

Key snippets from vhost definition (i.e. part of httpd.conf)

 <Directory /opt/www/hello.ogbuji.net/cgi-bin>
    Options +ExecCGI
    Order allow,deny
    allow from all
 </Directory>

 <Directory /opt/www/hello.ogbuji.net>
    Options FollowSymLinks
    Order allow,deny
    allow from all
 </Directory>

 Alias /moin "/usr/share/moin/htdocs/"
 ScriptAlias / "/opt/www/hello.ogbuji.net/cgi-bin/moin.cgi"

 RewriteEngine on
 RewriteRule ^/wiki/[^/]+/(.*) /opt/www/hello.ogbuji.net/cgi-bin/moin.cgi/$1  [last,type=application/x-httpd-cgi]

Make sure /opt/www/hello.ogbuji.net/cgi-bin/moin.cgi is correctly updated to load farmconfig.py, as usual.

Key snippets from farmconfig.py:

wikis = [
    ("alpha",  r"^hello.ogbuji.net/wiki/alpha.*$"),
    ("beta",  r"^hello.ogbuji.net/wiki/beta.*$"),
]

And other than that, config should be pretty typical of use with Apache/CGI. The trick here is the rewrite rule:

RewriteRule ^/wiki/[^/]+/(.*) /opt/www/hello.ogbuji.net/cgi-bin/moin.cgi/$1 #...

Which matches e.g. http://hello.ogbuji.net/wiki/alpha/FrontPage and translates it to http://hello.ogbuji.net/opt/www/hello.ogbuji.net/cgi-bin/moin.cgi/FrontPage. moin.cgi sees the original, pre-rewrite URL, and so it matches it to the farmconfig entry just fine, and identifies the right wiki instance. It also gets the FrontPage, which allows it to get the right page from the right wiki. Most such examples use a pattern such as ^/wiki/(.*), but this leaks the wiki name into the page spec for moin.cgi, and so it would think you were accessing a page called alpha/FrontPage, which is clearly wrong. Adding that [^/]+/ bit "eats" the wiki name before passing it to moin.cgi, correcting the problem.

MoinMoin: HelpOnConfiguration/ApacheCgiWikiFarm (last edited 2008-08-29 19:34:04 by UcheOgbuji)