MoinMoin Wiki Configuration
Contents:
1. Wiki software setup
The Wikis are provided by MoinMoin running under Apache httpd. See HelpOnInstalling for generate installation instructions, and HelpOnInstalling/WikiInstanceCreation for setting up a new wiki site.
Each wiki is configured to run as an Apache CGI process, each under its own username (in order to ensure that cross-activity security is maintained). (This requires, among other things, that the scripts concerned are run from a subdirectory of /var/www, this being the document root configured into suecec: type suexec -V to see the suexec options.)
When copying the initial wiki data/ and underlay/ directories, set the userid and groupid for the copied files to those that will be used to run the corresponding wiki process (see the Apache virtual host setup below); e.g.
chown -R bioimage:bioimage /var/www/wikis/bioimage
The main Apache configuration file is /etc/httpd/conf/httpd.conf, which contains the following lines to configure the main web site
http://antiparos.zoo.ox.ac.uk, and to enable virtual hosting (virtual hosts are defined following the pattern of Apache module/application .conf files, using .host filename suffixes):
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerAdmin admin@domain
DocumentRoot "/var/www/html"
ServerName antiparos.zoo.ox.ac.uk
</VirtualHost>
#
# Load specific virtual host details from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.host
Each virtual host is defined by a separate file following a common pattern. Here is the configuration file /etc/httpd/conf.d/bioimage.host:
#
# VirtualHost bioimage.ontonet.org
#
<VirtualHost *:80>
DocumentRoot "/var/www/wikis/bioimageweb"
ServerName bioimage.ontonet.org
Alias /moin /var/www/wikis/bioimageweb/cgi-bin/moin.cgi
Alias /index.html /var/www/html/index.html
ServerPath /bioimage
ServerAdmin admin@domain
SuexecUserGroup bioimage bioimage
<Directory /var/www/wikis/bioimage/cgi-bin/>
Options +ExecCGI +Indexes
AddHandler cgi-script .cgi
</Directory>
</VirtualHost>
Note that the <VirtualHost> directives must exactly match the NameVirtualHost directive. The alias 'wiki' is reserved (see below?)), and must not be used for the wiki URI; I chose to use 'moin'. (I could have simply mapped the root path '/' for the wiki, but did not want to exclude the possibility of having other web site content at the same domain name.) The second 'Alias' directive maps the root path to a common index page for this server. Do not try to alias the root path '/', as this messes up access to the wiki stylesheets, etc.
The SuexecUserGroup directive causes the wiki processor (and all CGI processes for this virtual host) to run with the given UID and GID. By using different UID/GID for each wiki, security is enhanced by maintaining operating system separation of access permissions. Note that this works only when the script is run from a directory or subdirectory of the document root statically configured into suecec: type suexec -V to see the suexec options.
The ServerPath isn't used in the way the Apache documentation seems to describe, but it does appear to be needed for the URI to be mapped properly.
There is also a configuration file /etc/httpd/conf.d/moin.conf for the MoinMoin wiki software, whose main purpose is to provide a link to the shared wiki data files, stylesheets, etc., using the alias 'wiki'. This file is needed, or the suexec wrapper will not be run to access the wiki, and HTTP 403 errors may result (this is not well covered in the moinmoin installation instructions).
# Apache configuration for moinmoin on antiparos # Alias /wiki /usr/local/share/moin/htdocs/
2. Wiki site creation
Full details are in the pages noted at the top of this page, but here is an example used to create a new site on our server, called bioimageweb and with ownership bioimage:bioimage:
# Some definitions # (bin is /usr/local/bin) export PREFIX=/usr/local export SHARE=$PREFIX/share/moin export WIKILOCATION=/var/www/wikis export INSTANCE=bioimageweb # change for a new instance export USER=bioimage # change for a new instance export GROUP=bioimage # change for a new instance # Now create the basic wiki cd $WIKILOCATION mkdir $INSTANCE # make a directory for this instance cp -R $SHARE/data $INSTANCE # copy template data directory cp -R $SHARE/underlay $INSTANCE # copy underlay data directory cp $SHARE/config/wikiconfig.py $INSTANCE # copy wiki configuration sample file chown -R $USER:$GROUP $INSTANCE # Set file ownership for new instance
3. Wiki site configuration
Wiki web site configuration is determined by three files:
/usr/local/lib/python2.4/site-packages/MoinMoin/multiconfig.py - is a default configuration for all wikis on this system. This can be edited, but there is probably a better approach based on using 'farmconfig.py' (see moin.cgi for clues).
/var/www/wikis/bioimage/cgi-bin/moin.cgi - is the main CGI wrapper file for a MoinMoin wiki, and must be edited to add the directory of the main wiki directory to the Python path thus:
sys.path.insert(0, '/var/www/wikis/bioimage')
/var/www/wikis/bioimage/wikiconfig.py - is a file that defines specific configuration options for the particular wiki instance. Most importantly, the site name and directories for the wiki are, as well as options to enable access control. Look for the following directives.
data_dir = '/var/www/wikis/bioimage/data/' data_underlay_dir = '/var/www/wikis/bioimage/underlay/' url_prefix = '/wiki' allowed_actions = ['DeletePage', 'AttachFile', 'RenamePage'] acl_enabled = 1 acl_rights_before = u"AdminGroup:read,write,delete,revert,admin" acl_rights_after = u"" acl_rights_default = u"UserGroup:read,write,delete,revert"
File protections: the wiki base directory and cgi-bin subdirectory must allow worl read access (or access to the Apache web server), otherwise access violations may be observed.
4. Wiki site initial population
With the wiki site set up and running, populate the following pages, copying from (say) bioimageweb as an example:
Create a login account for the administrator, and a home page. (I find it can be useful to link /MoinEditorBackup from this home page.)
Create an initial front page for the wiki
Create pages for UserConfiguration, AdminGroup, UserGroup
Create a GeneralTemplate page so new pages can be created with some semblance of consistent style
Create any other pages referenced by the initial front page
-- GrahamKlyne 2005-05-12 14:13:01