This HTML page contains the basic install docs that can be found on It contains all necessary information to get your wiki up and running, even without being online. If you have a permanent internet connection, you might want to browse the docs on the HelpOnInstalling page, which might contain more up-to-date information.

After following the procedures on this page, you should have a working wiki and can browse the rest of the online docs there.

How to install your own MoinMoin Wiki

This page describes the installation procedure of MoinMoin. In the next section, there is a list of real-world Installation Scenarios that help you to understand how to apply the instructions in different environments. If you already have a wiki running and want to upgrade, see MoinMaster:HelpOnUpdating.

A MoinMoin installation is done by some elementary steps:

Installation steps specific for some web servers and operating systems

The following links will show you concrete examples of installation sessions, showing the commands used and explaining what they do. You must first read the general information on installing above before doing the installation steps described on the pages linked from below:


Long-Running-Process Setup:

Mac OS X:


Basic Installation

Before you can integrate MoinMoin into your web environment, you have to do the basic installation using the standard Python distutils mechanism. We'll explain the usual steps you need to take to do this. For more details on the distutils installation process, consult the Installing Python Modules document of your Python manual.

  • /!\ NOTE: You will need the Python Development package installed on UNIX systems for distutils to work correctly.

The first step is to unpack the distribution archive, which you have done already when you loaded this instructions from your disk. If you read this on the web, the distribution comes in a versioned ZIP or TAR archive, which you can unpack in the usual ways, into a temporary directory (/tmp on UNIX, C:\TEMP on Windows). The distribution archive will always unpack into a directory named moin-<version>, for example moin-0.11. To download the distribution archive, go to the download area.

After unpacking, to install into a specific directory (C:\moin in our example), call after changing your current directory to the distribution directory. The following commands can be used to complete theses steps:

  •     unzip
        cd moin-0.11
        python --quiet install --prefix=C:\moin

This creates the following directories in "C:\moin" (note that on a UNIX system, the directory layout will be slightly different):

  •     MoinMoin

You will likely see the following warning:

  • warning: install: modules installed to 'C:\moin\', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself

This means exactly what it says, you need to add your install directory to the search path of Python. There are several ways to do this:

Environment variable

Change PYTHONPATH in a way that is persistent (/etc/profile.d on UNIX, AUTOEXEC.BAT on W9x, the Properties item in the context menu of My Computer on NT4 and W2K)

Apache "httpd.conf"

Use the SetEnv directive to set PYTHONPATH to a suitable value, for example:

    SetEnv PYTHONPATH "C:\moin"
Directly add your installation directory to

the CGI driver script, like this:

    import sys

If you use the following default installation command, MoinMoin will be installed to the Python directory:

  •     python --quiet install

You won't need to change your PYTHONPATH then, but depending on your system environment you might not be able to use that command, especially when you are not the root user on a UNIX system. If you don't know where your Python directory is, this command will tell you:

  •     python -c "import sys; print sys.prefix"

The directory structure we showed above will then be created in that directory. If you're interested in the exact list of files that are installed, use the --record option of distutils.

After you have downloaded and installed MoinMoin, you will want to "have a wiki". As explained at the bottom of ../BasicInstallation, you have to copy several directories and files. This way, you can have as many wikis as you want, and you can easily upgrade MoinMoin: only the original files will be overwritten, not your copies.

Every time you copy those files (and modify the configuration of your server accordingly), you create what is called a wiki instance. Each wiki instance is independent from the others, with a different configuration, different pages, different users, etc.

Some of the steps you need to take depend on which web server and which operating system you use. They are described on dedicated pages, which you should read (at least the beginning) before reading this one. Some other steps are common to every webserver and operating system (copying files around, setting permissions), and this is what is described here.

Linux users can download and use (a bash script that creates the instance) instead of doing all steps manually:

  1. If anything is unclear, just read the sections below for more hints.
  2. Have a look into the script before running it, if all settings are correct for your setup:
    • If your system does not have /bin/bash. try /bin/sh (or whatever your shell is called) - see the first line in the script.

    • USER and GROUP should be the user and group used by your web-server for running moin.
    • SHARE is where the shared files were copied to, see install.log from the install step

  3. Make the script executable (e.g. chmod +x

  4. The script takes a single parameter: the location of your wiki instance (see "Choose a location" section below):
    # ./ /path/to/mywiki
  5. Now continue in section "Tune configuration"

Read this first

Security warnings

/!\ Warning: make sure that your data directory and your configuration files are not accessible through your web server. Do not put your wiki directory in public_html, Sites or any other directory your web server can access. The web server only needs to access the file in the htdocs directory and the moin.cgi script! (Or whatever script your server uses to start MoinMoin.)

/!\ Warning: make sure that the data directory and its subdirectories are not readable and not writeable by users other than the web server user. If you need to give worldwide read-write permissions to get it working, be aware that you are doing a very unsecure setup, that can be compromised by any other user or program on your computer.

Note to Windows users

All the commands below are Linux commands. The text descriptions that introduce them should be enough to help you understand what you need to do. Use the Windows Explorer, or the appropriate text-mode commands.

Choose a wiki name

Choose a unique name for the new wiki instance you want to create. It should be a short word, something that reflects what you intend to use the wiki for, like the name of your organization, of your team, of the project you are working on, etc.

The name "mywiki" is used as an example in the various commands below.

Choose a location

Choose a directory on your disk, it will contain all the files needed for your wiki instance. At the beginning, your wiki instance will use approximately 10 MB of disk space. Then of course, it will grow depending on the way your wiki is used. A personal wiki, even with many pages, might only use 30 MB or 40 MB of disk space. A popular wiki, or a wiki with many files attached to the pages, might use much more, of course.

If you are the administrator (or root) of the server, you can use anything you like or that makes sense to you, for example /usr/local/var/moin, /mnt/wikis, etc.

If you are a simple user, you will probably only be allowed to write in your personal, "home" directory. Choose a subdirectory that makes sense to you, for example the share/moin subdirectory.

Collect some important information

This is where the instructions differ according to the web server and operating system you use, and whether you are the administrator or a simple user. See the appropriate pages for your web server and operating system combination.

On Linux, the export command will be used to remember the collected information. Windows users should write it down carefully (maybe cutting-and-pasting in a Notepad window), or store it in environment variables if they use the command prompt.

  • PREFIX is the prefix you used during the ../BasicInstallation

  • SHARE is the name of the share directory, as discussed at the bottom of ../BasicInstallation

  • WIKILOCATION is the name of the directory that will contain your wiki instance

  • INSTANCE is the directory containing the wiki instance. It cannot be an existing directory readable through Apache, otherwise it will fail.

If you are an administrator, you also need to collect the following:

  • USER is the user name of the web server

  • GROUP is the name of the group to which the web server belongs

Now, Linux folks, let's store these settings in memory:

> export PREFIX=/usr                # this might be something else
> export SHARE=$PREFIX/share/moin   # this should be correct for most people
> export WIKILOCATION=$SHARE        # this is just an example
> export INSTANCE=mywiki            # this is just an example

Administrators also need the following two lines:

> export USER=www-data              # this is just an example
> export GROUP=www-data             # this is just an example

Copy the files

To create your new instance, you first need to create a directory named like your instance, inside the WIKILOCATION. Then you need to copy the data and underlay directories from your SHARE directory into your instance directory. Finally, you need to copy the file from the config directory into the instance directory.

Linux folks need to just type these commands:

> 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/ $INSTANCE   # copy wiki configuration sample file
  • /!\ Note that you just need to keep one underlay directory on your system if you are running multiple wikis (e.g. in a farm.)

Set permissions


Administrators need to restrict the permissions of the files, so that only the web server (and the administrator of course) can read and write them. For maximum security, no other user on the machine should be able to read or write anything in the wiki instance directory. Don't forget that this directory contains sensitive information, notably the (encrypted) passwords of the wiki users.

On Linux, the following commands should be enough:

> chown -R $USER.$GROUP $INSTANCE   # check that USER and GROUP are correct
> chmod -R ug+rwX $INSTANCE         # USER.GROUP may read and write
> chmod -R o-rwx $INSTANCE          # everybody else is rejected

Normal users

Normal users, on the contrary, need to broaden the permissions of the files, so that the web server can read and write them. On recent Windows versions, and on some versions of Linux and other systems, access control lists can be used to that effect. They are, however, powerful and complicated, much beyond the scope of this document. Ask a knowledgeable person about them.

Without them, normal users have to allow everybody to access the instance directory. This is the only way the web server can enter it and do its work. This is, of course, VERY INSECURE, since any other user and program on the server can read the directory. You should not use such a setup for a wiki open to the public.

On Linux, the following commands will open the instance directory to the whole world:

> chmod -R a+rwX $INSTANCE


  • it is also possible to put the web server and the normal user in the same group, and then only open the instance directory to the members of that group. This is a bit more secure (depending on who else is in the group), but you need the cooperation of the server administrator; he is the one setting up groups.

  • the best other possibility is that the server administrator sets up suexec to execute CGI scripts in user directories under the user id of that user. You don't need to give world permissions that way, so it is a quite secure setup, but you also need cooperation of the administrator.

Tune configuration

Now, you need to tune the configuration of your web server and of your wiki instance. Look at the appropriate help page for your web server, then come back here to tune the settings of your wiki instance.

Edit The default settings should work fine in most cases, but there are some things that you will probably want to change, like the name and logo of your wiki! :) Read the comments inside, they will guide you through this process.

/!\ Warning: don't forget to restart your web server in order to apply changes in

HelpOnConfiguration contains all the details about all the options, in case the comments in are not enough.

Linux Installation using Apache

This page describes the particular steps that need to be taken to create a wiki instance using MoinMoin on Linux with the Apache web server. You should have already performed the ../BasicInstallation. Installations on other Unices like FreeBSD are very similar.

On this page two installation scenarios are discussed:

  1. You have Administrator Rights (you are user 'root' or may use sudo) for a server and are able to install and modify files almost anywhere on the machine, and notably able to modifiy the Apache configuration.

  2. You are a Simple User, only able to write files into your home directory, and unable to alter the master Apache configuration file.

The following options are not mentioned here:

Table of contents

Administrator Scenario

The exact location of the various Apache configs varies - often used locations are: /etc/httpd/, /etc/apache/ or /etc/apache2/. You should have at least some know-how of how to set up and deal with Apache, especially when it comes to virtual host setup. If you do not know what we are talking about, please read about Configuration Files and Apache Virtual Host documentation in the Apache documentation.

On Apache2 it is quite usual to have a directory (like /etc/httpd/conf.d) for virtual hosts. So every file ending with .conf will be included into the main Apache configuration file. To look if this is true for your configuration, search for the word "Include".

Create a wiki instance

Creating a wiki instance involves copying files around and setting appropriate permissions. Before you can proceed, you need to know what user and group your Apache server runs as. The easiest way to know this is to issue this command:

> egrep "^User|^Group" /etc/httpd/httpd.conf
User wwwrun
Group nogroup

This shows a typical result: "wwwrun.nogroup". Other common results are "nobody.nogroup", "apache.apache" and "www-data.www-data". You can of course use your own. What matters is that you know which ones are in use, because you will need them to set file permissions.

Once you have gathered this information, read ../WikiInstanceCreation and follow the steps described there.

Install moin.cgi

There is one last file you need to copy, the bridge between Apache and MoinMoin: the CGI script that Apache will call every time a wiki page is requested, and that will in turn invoke all the MoinMoin components to handle the request. You can actually put this script anywhere you like (all the paths to the files MoinMoin needs can be configured to match your filesystem layout), but for the sake of simplicity and security, we suggest you follow the instructions below, unless you think you know better.

We will create a cgi-bin subdirectory in the instance directory. Using the environment variables defined in ../WikiInstanceCreation, run the following commands:

> mkdir cgi-bin
> cp $SHARE/server/moin.cgi cgi-bin
> chown -R $USER.$GROUP cgi-bin
> chmod -R ug+rx cgi-bin
> chmod -R o-rwx cgi-bin

Configure moin.cgi

When moin.cgi is launched, it imports a MoinMoin module that in turn imports other modules and the configuration file. While the MoinMoin modules should always be found in a properly configured system (as described in ../BasicInstallation), it is likely that the configuration file will not be found. Edit the moin.cgi script to correct that. Add these lines near the top of the file:

import sys
sys.path.insert(0, '..')

An even better way is to use the absolute path name of the directory that contains the file instead of '..'.

Configure Apache

Now that every file is in place and properly locked down (as far as the filesystem is concerned), we need to configure Apache so that it offers access to the right files, and no others. However, since the default Apache configuration varies a lot depending on the distribution you use, and since administrators often make important additions and changes to it, we cannot give exact instructions that cover all cases. Instead, we will first describe roughly what needs to be done, and then give a few specific lines that you should add at the appropriate place in your Apache config.

Your Apache should be set up so that:

  • Access to your instance directory is denied (sane Apache installations should actually deny access to the whole server, and then only allow a few specific directories).
  • An Alias is set up to redirect requests from /moin_static160/ (in the URL - see also url_prefix_static configuration variable) to the htdocs directory (in the share directory, as discussed at the bottom of ../BasicInstallation). Please note that url_prefix_static will change with every moin release!

  • A ScriptAlias is set up to redirect requests from whatever you want (we suggest you use your instance name, for example /mywiki) to the CGI script you just copied.

The following commands will add two lines at the bottom of your Apache config file. These lines only cover the last two items listed above. You have to check the first one by yourself (there is too much variation in Linux distributions). Note that you may have to move the two lines to the appropriate place in your config file -- maybe near other similar lines.

> echo "" >>/etc/httpd/httpd.conf
> echo "Alias /moin_static170/ \"$SHARE/htdocs/\"" >>/etc/httpd/httpd.conf
> echo "ScriptAlias /mywiki \"$WIKILOCATION/$INSTANCE/cgi-bin/moin.cgi\"" >>/etc/httpd/httpd.conf

So this would add two lines like the both below to a config file (possibly you use one for each virtual server):

Alias /moin_static170/ /usr/local/share/htdocs/
ScriptAlias /mywiki /usr/local/share/moin/mywiki/cgi-bin/moin.cgi

You only need to define the Alias for htdocs once, no matter how many wikis you run with the 1.6.0 version of moin. You need to define a different script alias for each wiki instance you intend to run. So you could also define the Alias in a central Apache configuration file and only define the ScriptAlias in virtual host configurations.

Configure MoinMoin

Finally, check that the file in the instance directory contains correct paths for:

  • url_prefix_static (static stuff like css/img/js)

  • data_dir (the instance data directory) and

  • data_underlay_dir (the instance underlay directory).

You can use relative paths for the directories, but note that they are relative to the CGI script, not the configuration file! Better use absolute paths, and save yourself some headaches.

Here are the settings you should have in the config file if you followed all our suggestions:

    data_dir = '../data/'  # better use absolute path
    data_underlay_dir = '../underlay/'  # better use absolute path
    url_prefix_static = '/moin_static160' # depends on moin version

There are other settings you will likely want to alter, look at the bottom of ../WikiInstanceCreation for more details about them.

Test the wiki

Everything should work fine now. It is time to restart the Apache server (usually with "/etc/init.d/apache restart", sometimes with "apachectl restart") and perform the following steps:

  • Access your new wiki with the URL "" (or the name and port you have defined in the Apache configuration file). You should see some wiki page - read it.

  • Then go to the WikiSandBox page.

  • Try to edit it and save your changes.
  • If that works, see if your edit is reflected on the RecentChanges page.

  • If you see them, congratulations, your new wiki works! :)

If something goes wrong, have a look at Troubleshooting, at the bottom of this page.

Simple User Scenario

On machines shared by many people, simple users typically have no access to the root account, cannot modify the httpd.conf file, and cannot copy files into the system-wide cgi-bin and htdocs directories. In that case, Apache can be set up so that each user can host a web site in the home directory of his or her shell account, using the UserDir directive. If the machine administrator decides to use it, all URLs that start with "/~username" will be redirected to a directory in the users' home directories, where they have write permission and can install MoinMoin.

As an example, we will consider the case of a user named "mm". Of course, wherever you see "mm" below, you will replace it with your own username.

Make sure /~username works

The home directory installation can only work if the administrator (root) has allowed it. So, the first step is of course to check that it works. Typically, Apache is set up so that the public_html subdirectory in the home directory is used as the web site root. So, the first first step is to check if that directory exists.

> ls -ld ~/public_html
drwxr-xr-x   2 mm       users        4096 Nov 30 00:29 public_html

If the directory does not exist, create it, and be sure it can be read and entered by the web server.

> mkdir public_html
> chmod a+rx public_html
> ls -ld ~/public_html
drwxr-xr-x   2 mm       users        4096 Nov 30 00:35 public_html

Now, check if the "/~mm" URL works:

> lynx -error_file=/dev/stderr -dump http://localhost/~mm/ >/dev/null
URL=http://localhost/~mm/ (GET)

If you get a "200 OK" response code, then it works, and you can go on to the next check. If you get a "403 Forbidden" or a "404 Not Found" response, then maybe something is wrong with your directory, or maybe the whole thing has not been enabled by your administrator.

  • Check the permissions for your home directory (~) and your public_html directory. The first one should at least end with "--x", and the second one, as we saw above, with "r-x".

  • It also possible that the administrator has set up another name for the personal web site directory. "public_html" is just the usual default, but anything can actually be used. There is no way to know, you have to ask the administrator (root).

  • Finally, if the personal web site feature is disabled, maybe you can ask the administrator to enable it?

Once you have checked you can read the files in the directory, you need to check that you are also able to execute CGI scripts in that directory. Use the following commands to create a simple CGI script in the appropriate location:

> mkdir -p ~/public_html/cgi-bin
> cat > ~/public_html/cgi-bin/test.cgi
echo Content-Type: text/plain
echo "CGI scripts work"
> chmod a+rx ~/public_html/cgi-bin/test.cgi
> lynx -dump http://localhost/~jh/cgi-bin/test.cgi
CGI scripts work

If you get anything else than "CGI scripts work", then something went wrong. Check the directory permissions as above, try other names (or ask about them). The sad truth might be that you are not allowed to execute CGI scripts. You would then have to ask the administrator (root) for that permission.

Once you get it, you can set up your wiki instance in the public_html directory. :)

Create a wiki instance

Creating a wiki instance involves copying files around and setting appropriate permissions. Read ../WikiInstanceCreation and follow the steps described there.

Install the htdocs files

The web server needs to access these files, so we need to copy them into the "public_html" directory. Just use this:

> cd ~/public_html
> cp -R ~/share/moin/htdocs moin_static170
> chmod -R a+rX moin_static170

Install moin.cgi

There is one last file you need to copy, the bridge between Apache and MoinMoin: the CGI script that Apache will call every time a wiki page is requested, and that will in turn invoke all the MoinMoin components to handle the request. You need to put this file in a directory for which CGI scripts execution is enabled. By default, this should work:

> cd ~/public_html
> mkdir cgi-bin
> cp $SHARE/server/moin.cgi cgi-bin
> chmod -R a+rx cgi-bin

Configure moin.cgi

When moin.cgi is launched, it imports a MoinMoin module (that in turn imports other modules and the configuration file). Since everything has been installed in your home directory, it is likely none of these will be found. Edit the moin.cgi script to correct that. Add these lines near the top of the file:

import sys
sys.path.insert(0, '/home/mm/lib/python2.4')
sys.path.insert(0, '/home/mm/lib/python2.4/site-packages')
sys.path.insert(0, '/home/mm/share/moin/mywiki')

Of course, you need to adapt the paths to your situation. The first two lines should help locate the MoinMoin modules, the last one should help locate the file.

Note: You might also need to edit the first line of the file, to point to the correct version of Python. The default should be fine, but a line like "#! /usr/bin/python2.4" might help you if the default does not work.

Note 2: If you are using mod_rewrite (rather than ScriptAlias) to change the wiki URL, you need to add a properties = {'script_name': '/mywiki'}  line to this file where indicated in the comments. This will let MoinMoin generate URLs that start with /mywiki and not the path that the webserver passed to MoinMoin. For example:

     # Properties
     # Allow overriding any request property by the value defined in
     # this dict e.g properties = {'script_name': '/mywiki'}.
     ## properties = {}
     properties = {'script_name': '/mywiki'}

If you're serving the wiki from the root URL, use  { 'script_name': '/' } .

Configure MoinMoin

Finally, check that the file in the instance directory contains correct paths for url_prefix_static (the htdocs directory), data_dir (the instance data directory) and data_underlay_dir (the instance underlay directory). You can use relative paths for the directories, but note that they are relative to the CGI script, not the configuration file! It is better to use absolute paths, and save yourself some headaches.

    data_dir = '/home/mm/share/moin/mywiki/data/'
    data_underlay_dir = '/home/mm/share/moin/mywiki/underlay/'
    url_prefix = '/~mm/moin_static170'

Test the wiki

Everything should work fine, now. It is time to perform the following steps:

  • If it worked, try to access your new-born wiki with the URL "". You should see some wiki page - read it.

  • Now go to the WikiSandBox page.

  • Try to edit it and save your changes.
  • If that works, see if your edit is reflected on the RecentChanges page.

  • If you see them, congratulations, you have a new wiki! :)

If something goes wrong, have a look at Troubleshooting, below.


See also ../TroubleShooting for generic stuff.

The first thing to do when your wiki does not work as expected is to issue the command "tail /var/log/httpd/error_log" to display the most recent errors. Usually, you will get a hint on what went wrong, like missing file system permissions.

Adding permission to serve the htdocs directory

In some (sane) Linux distributions (like SuSE 9.0) serving directories other than the document-root "/srv/www/htdocs" with Apache is switched off by default for security reasons in "/etc/httpd/httpd.conf" (or for Apache2 "/etc/apache2/httpd.conf"):

# forbid access to the entire filesystem by default
<Directory />
  Options None
  AllowOverride None
  Order deny,allow
  Deny from all

To allow Apache to serve directories outside of the document root you have to add these lines to "/etc/httpd/httpd.conf" (in SuSE it is recommended to create a new "http.conf.local" and include this file in "/etc/sysconfig/apache2"):

Alias /wiki/ "/usr/share/moin/htdocs/"
<Directory "/usr/share/moin/htdocs/">
   Order deny,allow
   Allow from all
ScriptAlias /mywiki "/usr/share/moin/mywiki/cgi-bin/moin.cgi"
<Directory "/usr/share/moin/mywiki/cgi-bin">
   Order deny,allow
   Allow from all

Of course, you need to adapt the paths to your particular situation.

FastCGI Setup using Apache or Lighttpd

FastCGI is a method which enables a web server to communicate with long-running scripts. This has the advantage that the script is only started and initialized one time, and that data could be cached in memory from request to request, enhancing the performance of the CGI application.

Using MoinMoin with FastCgi

For more general information:

Deploying on Apache

To deploy MoinMoin using FastCGI you need an apache with mod_fastcgi. Please refer to the documentation of mod_fastcgi ( mod_fastcgi homepage ).

Don't forget to install the fastcgi Apache module (e.g. libapache2-mod-fastcgi). Then in places where the documentation refers to moin.cgi you use moin.fcg instead. Be sure that .fcg is handled by the FastCGI module (AddHandler fastcgi-script .fcg in your apache config).

Normally Apache will start CGI scripts with its own user and group, or with the user and group of the VirtualHost if you are using the suexec wrapper. To enable this with FastCGI you need to use FastCgiWrapper On in your Apache config (check your distributions and/or FastCGI Documentation).

Be sure to restart your Apache after you changed py files (i.e. the config) for a running FastCGI server, or you won't see any changes!

Script options

No matter how and where you install or how you configure, you can add some options (in Apache config or as self-running process). Here is a list of some options.


-host [hostname:port]     - The port and on what host name to respond.
-idle-timeout [seconds]   - The number of seconds of inactivity allowed before request is aborted.


-port [port]              - The port the application will use for communication with the web server.
-idle-timeout [seconds]   - The number of seconds of inactivity allowed before request is aborted.

Example for Apache2 on Debian

Edit the /etc/apache2/conf.d/your_wiki:

<IfModule mod_fastcgi.c>
   AddHandler fastcgi-script .fcgi .fcg
   FastCgiServer /your/path/to/moin.fcg -idle-timeout 60 -processes 1
   ScriptAlias /your_wiki "/your/path/to/moin.fcg"
  • number of processes depends on your hardware..

Expand the Apache installation:

apt-get install libapache2-mod-fastcgi
a2enmod fastcgi
apache2ctl graceful

Now, your wiki should respond a little faster.

Running as an external application and/or on Windows

(see also ../ApacheOnWin32withFastCgi for a Windows-specific how-to)

MoinMoin can be run as an external application that answers FastCGI request via a local TCP/IP socket. This works on Windows as well. All you need to do (after having installed mod_fastcgi and a working MoinMoin instance) is this:

  1. Select a port number for the internal communication. It should be larger than 1023. For this example, we chose 8888 (just for fun).
  2. Add the following lines to your httpd.conf:

    Alias /moin.fcg "/your/path/to/moin.fcg"
    FastCgiExternalServer "/your/path/to/moin.fcg" -host localhost:8888
  3. Edit moin.fcg. Replace

    fcg = thfcgi.FCGI(handle_request, max_requests=max_requests, backlog=backlog, max_threads=max_threads)


    fcg = thfcgi.FCGI(handle_request, 0, 8888, max_requests=max_requests, backlog=backlog, max_threads=max_threads)
  4. Start the file moin.fcg manually like a Python script:

    python moin.fcg
  5. Start Apache.

Fallback to CGI if FastCGI is not available

Install and test MoinMoin according to HelpOnInstalling/ApacheOnLinux. Then make and test the changes to run mod_fastcgi. If you are satisfied, you can add the following block to your apache config:

<IfModule !mod_fastcgi.c>
    ScriptAlias /mywiki "/your/path/to/moin.cgi"
<IfModule mod_fastcgi.c>
    AddHandler fastcgi-script .fcg
    ScriptAlias /mywiki "/your/path/to/moin.fcg"

Now Apache will use mod_fastcgi if available and otherwise use the slow cgi script.

Deploying on lighttpd

This is about running a wiki under "/" URL with lighttpd.

The moin.fcg processes will get spawned by lighttpd automatically (thus, if you want to restart moin, just restart lighttpd).

It will also take care about handling robots.txt and favicon.ico correctly.

First add fastcgi and rewriting support to your lighttpd.conf (if you don't already have it):

server.modules              = (
                                "mod_rewrite",      # <--- IMPORTANT!
                                "mod_fastcgi",      # <--- IMPORTANT!

Then configure it to run moin.fcg for your wiki site and also serve the static stuff:

$HTTP["host"] =~ "^(www\.)?example\.org" {
    url.rewrite-once = (
        "^/robots.txt" => "/robots.txt",
        "^/favicon.ico" => "/favicon.ico",
        "^/moin_static161/(.*)" => "/moin_static161/$1",
        "^/(.*)" => "/wiki-engine/$1"
    server.document-root        = "/srv/org.example/htdocs/"
    $HTTP["url"] =~ "^/wiki-engine/" {
      fastcgi.server = ( "/wiki-engine" =>
        (( "docroot"   => "/",
           "min-procs" => 10,
           "max-procs" => 10,
           "max-load-per-proc" => 2,
           # allocate successive port numbers for each process, starting with "port"
           "bin-path"  => "/srv/org.example/bin/moin.fcg",
           "host"      => "",
           "port"      => 3060,
           "check-local" => "disable",

Finally adapt moin.fcg:

class Config(FastCgiConfig):
    loglevel_file = logging.INFO
    logPath = '/srv/org.example/logs/moin.log'
    max_requests = 1000
    properties = {'script_name': '/'}  # <--- IMPORTANT!

Using HTTP Authentication

lighttpd mod_fastcgi does not add the AUTH_TYPE variable to the cgi environment, which will cause http auth in moin to fail. See for more information, and an attached diff file to correct to issue.

MoinMoin Startup script

Here is a startup script for Mac OS X, using DarwinPortsStartup system. It is probably useful for other unix like platforms.

# Start and stop multiple moin fast cgi instances runnings on PORTS


# List of ports to start moin instances on, separated with whitesapce
# Keep in sync with fastcgi.server in lighttpd.conf
PORTS="1080 1081"

start_on_port () {
    # Start moin instance on port, leaving pid file
    cd "${DIR}" && sudo -u www "${PREFIX}/bin/spawn-fcgi" \
        -f "${FCGIAPP}" \
        -p $port \
        -P "${NAME}-${port}.pid" \
        > /dev/null

kill_on_port () {
    # Try to kill process using pid in pid file, then remove the pid file
    kill `cat "$pidFile"` && rm -f "$pidFile" > /dev/null 

start () {
    for port in $PORTS; do start_on_port $port; done 

stop () {
    for port in $PORTS; do kill_on_port $port; done

case "$1" in
    # XXX starting twice will break pid files (bug in spawn-fcgi)
    start && echo -n " $NAME"
        stop && echo -n " $NAME"
    start && echo -n " $NAME"
        echo "Usage: `basename $0` {start|stop|restart}" >&2

exit 0

Mac OS X: Adding MoinMoin startup script

With this script, moin instances will be started automatically on startup.

  1. Install darwinports

  2. Install DarwinPortsStartup package:

    sudo port install DarwinPortsStartup
  3. Copy into /opt/local/etc/rc.d:

    sudo cp /opt/local/etc/rc.d

mod_python Setup using Apache

Why Use mod_python

mod_python embeds the python interpreter into the apache server. This saves initialization time and the need of forking cgi scripts. It doesn't have the ability to run as different users. It will always run as the main apache user and group. Be sure that your wiki data files are accessible and writable by your apache server.

<!> The basic configuration is suitable for mod_python 3.1.3 and later. If you use older version, see the section "Older mod_python versions"

<!> mod_python will cause your apache processes to increase their memory requirements considerably - especially as apache runs many separate processes which will each need to have their own copy of the python code and data in the process memory space. You may find that FastCGI, as detailed in HelpOnInstalling/FastCgi is rather more efficient in this respect.

Basic configuring

  1. Install mod_python
  2. Set up a wiki instance
  3. Edit

  4. Changes to Apache httpd.conf

  5. Restart Apache

The sample configurations below are for a wiki instance called mywiki installed in a directory /var/www/moin/mywiki with the main MoinMoin installation installed in python's default site library path. The wiki appears as URL /mywiki under the server - ie http://my.ser.ver/mywiki. You will need to change these to reflect your installation.

Install mod_python

Most people will just add a mod_python package to their current operating system installation. If you are building from source then you should consult the mod_python documentation.

The mod_python installation should have added some lines to the Apache configuration file - either in the file itself or in an included configuration file (for example on Red Hat or Fedora linux the mod_python configuration is in /etc/httpd/conf.d/python.conf).

Make sure you have this line in httpd.conf or mod_python will not work:

LoadModule python_module modules/

After this restart Apache and make sure that it starts successfully, and that the error log has a line similar to this:-

[Sat Jan 01 15:40:49 2005] [notice] mod_python: Creating 4 session mutexes based on 150 max processes and 0 max threads.

You may need to change some environment variables on (eg) FreeBSD - this is detailed in the port installation message.

Set up a wiki instance

This is done as shown in WikiInstanceCreation. Its recommended to first configure the wiki with cgi and check that it works, then change the configuratin to use mod_python. This allows you be sure that any problems are in the mod_python transition rather than the basic MoinMoin installation.

  1. Copy moin.cgi into your wiki directory
  2. Configure httpd.conf as cgi first (the shown Alias is for moin version 1.6.0):

    • Alias /moin_static160/ "/usr/share/moin/htdocs/"
      ScriptAlias /mywiki "/var/www/moin/mywiki/moin.cgi"

Restart Apache and make test that your wiki works.

Edit ``

Make sure you use only absolute paths - relative paths will not work!

data_dir = '/var/www/moin/mywiki/data/'
data_underlay_dir = '/var/www/moin/mywiki/underlay/'

If you do not want to use absolute paths, you can use Python's os module to construct the relative paths: {{{import os data_dir = os.path.join(os.path.dirname(file), 'data/') data_underlay_dir = os.path.join(os.path.dirname(file), 'underlay/') }}}

Test that the wiki works after this change.

Changes to Apache `httpd.conf`

After your wiki is running as cgi script, convert it to run with mod_python.

If you run your wiki as cgi as we recommended before, remove or comment the ScriptAlias directive:

#ScriptAlias /mywiki "/var/www/moin/mywiki/moin.cgi"

Add a Location directive:

<Location /mywiki>
    SetHandler python-program
    # Add the path of your wiki directory
    PythonPath "['/var/www/moin/mywiki'] + sys.path"

If you have multiple MoinMoin instances then add one location directive for each one (changing the paths as appropriate) and add a line with the directive PythonInterpreter mywiki to each Location section. With this directive different subinterpreters with completely separate namespaces will be used for each wiki (see here for details).

If you did not install MoinMoin in the default location, you will have to add the path to MoinMoin to the system path:

    PythonPath "['/var/www/moin/mywiki', '/prefix/lib/python2.x/site-packages'] + sys.path"

Restart Apache - everything should now work correctly.

Solving problems for non-root-mounted wikis

  • /!\ If your wiki does not have a root URL (like, then you might need to follow the next steps:

On some installations, mod_python hands MoinMoin incorrect script_name and path_info. It usually happens when using the Apache Location directive, with a wiki in an arbitary path:

<Location /farm/mywiki>

This will not work, because its not clear what is the script name, since with location setup, there is no real script.

To solve this problem, use a PythonOption directive:

<Location /farm/mywiki>
    # Location value must match the Apache Location value!
    PythonOption Location /farm/mywiki

Configuring root wiki

You may wish to have your wiki appearing at the root of your webserver - for example so that will map to your wiki rather than having to use This requires a slightly different form of configuration using mod_rewrite - this is a standard module of recent Apache distributions, and is often enabled by default.

You need to set up your wiki instance as described above, and also copy from the Moin installation directory to the wiki instance directory (/var/www/moin/mywiki in these examples).

The Apache configuration needs mod_rewrite enabled - so the line

LoadModule rewrite_module modules/

should appear in the first part of the httpd.conf configuration file.

The wiki and virtual host configuration should look like this (Alias is for moin version 1.6.0):-

<VirtualHost *:80>
  DocumentRoot /var/www/html
  Alias /moin_static160/ "/usr/share/moin/htdocs/"

  # Rewrite urls
  RewriteEngine On
  RewriteLogLevel 0
  # map /wiki static files to Moin htdocs
  RewriteRule ^/moin_static160/(.*)$ /usr/share/moin/htdocs/$1 [last]
  RewriteRule ^/robots.txt$ /usr/share/moin/htdocs/robots.txt [last]
  RewriteRule ^/favicon.ico$ /usr/share/moin/htdocs/favicon.ico [last]
  # map everything else to server script
  RewriteRule ^(.*)$ /var/www/moin/mywiki/$1

  <Directory "/var/www/moin/testwiki">
    # Modpy stuff
    AddHandler python-program .py
    # Add the path to the wiki directory, where
    # and are located.
    PythonPath "['/var/www/moin/mywiki'] + sys.path"

Apache should be restarted, and the FrontPage of mywiki should now appear at

Other ways of handling root level wikis with Apache are detailed in the appropriately named HelpOnConfiguration/ApacheVoodoo.

Older mod_python versions

mod_python versions 2.7.10, 3.0.4 and 3.1.2b have a bug in apache.resolve_object. This bug was reported to the mod_python maintainers and has been fixed in the 3.1.3 release. The best fix for this is to update to the current release. However if you are unable to do this there are 2 possible solutions:

Use a wrapper script

MoinMoin come with a wrapper script, and this could be used by changing the PythonPath and PythonHandler directives as shown in the moinmodpy.htaccess file.

Fix mod_python

mod_python has a small resolver bug in versions 2.7.10, 3.0.4 and 3.1.2b. The method resolve_object in mod_python/ checks the wrong object, and so the lookup for fails.

To fix it you need to change the method resolve_object (around line 551 for mod_python 3.1.2b) from

        if silent and not hasattr(module, obj_str):
            return None


        if silent and not hasattr(obj, obj_str):
            return None


Page access gives apache error::

  • PythonHandler OSError: [Errno 2] No such file or directory: 'data/user' This appears to be caused by you not having an absolute path for data_dir in There are several other lines of error traceback preceding this one in the apache error log. Fix the path in

Setup using Twisted

Using MoinMoin with Twisted

Twisted is an event-driven networking framework for many kinds of applications. For MoinMoin Twisted is used as a web server that just imports MoinMoin persistently. This has the advantage that the Python interpreter and all Python scripts (including Twisted itself and also MoinMoin) is only loaded and initialized one time, and that data can be cached in memory from request to request, enhancing the performance of MoinMoin.

Besides the general installation you need 3 files:

  1. the script /path/to/cgi-dir/mointwisted (see "Starting the server" below)

  2. the webserver script file like (which needs to be in the same directory where your working directory is).

  3. the configuration file like /path/to/wikiconfig-dir/

Install Twisted

First, install Twisted (see URL above). Many Linux distributions have Twisted packages. Please refer to the documentation of Twisted for installation information.

Configuring the Twisted server

Copy the file wiki/server/ to your wiki directory. Edit and adapt the settings to your needs.

System path configuration

If you did a standard install, and you are not a developer, you probably want to skip this section. Otherwise, you might want to add the path to moin and config file, like that:

sys.path.insert(0, '/path/to/moin')
sys.path.insert(0, '/path/to/wikiconfig')

Config class options

If you did a standard install, the default options might be just what you need. Check and change what you like:






Path to moin shared files



If you run as root, the server will run as this user



If you run as root, the server will run as this group



Port to serve. To serve a privileged port below 1024 you will have to run as root



A list of interfaces the server will listen to. If the list contains the entry '' (like for the default configuration), all other entries are ignored and the server will listen to all interfaces.



Log file.


commented python code

Useful only if you are a moin developer.


The sample config file should be just fine.

Don't change url_prefix_static as the default value is hardcoded in the Twisted server.

Starting the server

on Unix

On GNU/Linux, Mac OS X or another POSIX-like OS, copy wiki/server/mointwisted to your wiki directory. You might want to adapt PYTHONPATH and the path to twistd.

Start the server with ./mointwisted start and test your wiki at http://localhost:8080/. Stop the server with ./mointwisted stop.

For more options run ./mointwisted without arguments.

If you want to start the server via initscript make sure mointwisted finds on startup!

on Windows

Copy wiki/server/mointwisted.cmd to your wiki directory. You might have to change the path pointing to the python-scripts directory.

Double click mointwisted.cmd to start the server. It will create a new terminal window. To stop the server, close the terminal window.

A windows service runner written in Python

I have written a service runner to help configuring a windows service to run, because I prefer to run moin using Twisted.


  1. install pywin32
  2. download
  3. modify the "mointwisted" and "mointwisted_dir" according to your system
  4. run " install" on the command line

Linux Installation using standalone server

Installing and configuring standalone server

See also: HelpOnConfiguration/IntegratingWithApache

The standalone server is especially made for local wikis because it does not need a web server installed. Only Python and Moin are necessary!

The quick way

See DesktopEdition.

The flexible way

Instead of just running it like described above, you can of course move stuff to different places (see ../BasicInstallation, ../WikiInstanceCreation).

You can then invoke the moin standalone server using the moin scripting command:

# for details and other options, see: moin server standalone --help
moin --config-dir=/etc/moin server standalone --docs=/usr/share/moin/htdocs

Of course you have to give correct values that match your setup:

  • --config-dir gives the directory that contains your wikiconfig (or farmconfig).

    • wikiconfig points to other important pathes, e.g. data_dir and underlay_dir

  • --docs gives the directory where moin finds the static files (css, imgs, etc.)

If it does not find the moin command:

  • if you used it should have copied it to /usr(/local)/bin - check your PATH.

  • if you don't want to use just write your own moin command script:

    #Fix and uncomment those 2 lines if it doesn't find the MoinMoin package:
    #import sys
    #sys.path.insert(0, '/path/to/moin_code')
    from MoinMoin.script.moin import run

(!) If it crashes and tells it can't import MoinMoin, then just uncomment and fix the sys.path stuff you see above.

Now point your browser at http://localhost:8080/ (or whatever moin tells you).

If you want to run the moin process as a daemon, have a look at the --start, --stop and --pidfile options.

Serving port 80 on Unix

On GNU/Linux, Mac OS X or other Posix like OS, you can serve the standard port 80 used for web serving, but you must start moin as root for this or redirect a port as root.

1st method (recommended)

Run standalone on port 8080 as described above and using iptables redirect all traffic from port 80 to 8080, assuming your external ip adress is

-A net_dnat -d -p tcp -m tcp --dport 80 -j DNAT --to-destination

2nd method (not recommended)

Set port to 80, and verify that user and group exists on your system. If not, set them to an existing user, meant for web serving. If needed, chown your wiki dir to this user and group.

Standalone Server configuration

Alternatively to giving parameters by commandline options, you can also have a and specify your stuff in a Config class there. See the example file in the toplevel directory.






Server name, used by default for log and pid files.



Path to moin shared files. If you used --prefix install, the default path will not work, and you must set the path to 'PREFIX/share/moin/wiki/htdocs'.



If you run as root, the server will run with as this user



If you run as root, the server will run with as this group



Port to serve. To serve privileged port under 1024 you will have to run as root



The interface the server will listen to. The default will listen only to localhost. Set to '' to listen to all.


'ThreadPoolServer', 'ThreadingServer', 'ForkingServer', 'SimpleServer', 'SecureThreadPoolServer'

The server type to use, see the comments in the The default is 'ThreadPoolServer', which create a pool of threads and reuse them for new connections.



How many threads to create.



The count of socket connection requests that are buffered by the operating system.



allow overriding any request property by setting the value in this dict e.g properties = {'script_name': '/mywiki'}.



If using the SecureThreadPoolServer, this must point to the server's private key.



If using the SecureThreadPoolServer, this must point to the server's certificate.

  • (!) There may be more options useful to moin developers, see the comments in


The sample config file should be just fine.

The default value of url_prefix_static is hardcoded into the standalone server script, do not change it or it won't work!

Using the secure standalone server

The standalone server supports SSL when using the SecureThreadPoolServer server class. The SSL support is provided by the TLSLite library. All wiki traffic is forced to SSL when using the SecureThreadPoolServer.

Two additional configuration options are required when using the SecureThreadPoolServer. First, ssl_privkey must point to the server's private key. Second, ssl_certificate must point to the server's certificate.

/!\ TLSLite does not support a password protected private key unless additional libraries are used. Consult the TLSLite webpage for more information.

Typically a certificate would be purchased from an certificate authority, such as Thawte ( However, since the suggested usage of the standalone server is for personal use, a self signed certificate may be appropriate. For more information on how to generate a server private key, and a self signed certificate, see the openssl HOWTO pages.

For example, to create the server's private key, run the following:

openssl genrsa -out privkey.pem 2048

To create a self signed certificate for the newly created private key, run the following:

openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095 then needs to be told about the generated files privkey.pem and cacert.pem. For the example above, the following lines would need to be added to

    ssl_privkey = "/secure/path/to/privkey.pem"
    ssl_certificate = "/secure/path/to/cacert.pem"

/!\ Using a self signed certificate will cause your browser to generate a warning that it cannot verify the identify of the wiki server. This is because the certificate was not signed by a recognized certificate authority (CA). In order to get rid of this warning, you must purchase a certificate from a CA.

Serving Port 443

A secure standalone server may be run to listen on port 443, but this requires root to start the server. An alternative, is to use iptables to run a secure standalone server on an unprivileged port such as 8081 but redirect traffic through privileged port 443 (setting iptables requires root):

/sbin/iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8081
/sbin/iptables -t nat -A OUTPUT -o lo -p tcp --dport 443 -j REDIRECT --to-port 8081

It is also necessary to indicate that the https scheme is to be used instead of http. In the configuration (see above), a property must be set as:

    properties = { "is_ssl": 1 }

Mac OS X Installation using Apache

These instructions will walk you through, step by step, setting up Moin on Mac OS X

  • Apple's latest operating system, 10.5 Leopard, packs enough under-hood changes that, rather than a bunch of if/then instructions, going forward this page will be updated only for Leopard. If you have an older system (Tiger or Panther) you can click 'info' and view revision 45 for hints for those operating systems.

System Requirements & Preparation

MacOS 10.5 Leopard includes the latest version of Python, version 2.5.1. (Older versions 10.4-Tiger and 10.3-Panther include the minimum required versions of Python to run Moin without updating, 2.3.5 and 2.3 respectively).

MoinMoin installation requires the use of the Terminal and assumes you have a basic familiarity with commands and syntax. When you read commandline mentioned below, assume that you will enter these commands using the (located in /Applications/Utilities/

Make sure Apache is started ('Apple' menu > 'System Preferences...' > 'Sharing' panel > and check "Personal Web Sharing")


Installing MoinMoin

  1. Download MoinMoin

    • The most current version is here: MoinMoin:MoinMoinDownload

  2. Expand the archive

    • Double-click to expand the moin-X.X.tar.gz archive.

    • You should then have a folder such as moin-x.x where "x.x" is the current release number. This folder will contain a file in addition to several other files and subfolders. Optionally, you may want to move the expanded moin-X.X folder to a location more convenient to work from, like into a temp folder the root of your hard drive.

  3. Run from the commandline

    • Open and enter the commands:

      sudo -s
    • Now you have root privileges in this shell (note: the prompt will change from a $ to a #). To install, type:

      cd /temp/moin-1.6
    • (!) Important: Now you have to decide where you want to install your Moin wiki installation; this will be your wiki root folder. Unix traditionalists will install this into /usr/local because of long standing unix conventions. However, on Mac, this and other unix folders are typically hidden from the Finder. So, you may want to install outside this folder where you can more easily manage the files (such as drag-copy backups, editing config files using, etc). In the examples below, Moin is installed in a folder on the root of your hard drive named /moinwiki. If you want to follow unix conventions, simply substitute /usr/local for /moinwiki in all the examples below.

      python install --install-data='/moinwiki'
    • The --install-data='/moinwiki' argument tells the setup script where to put the data. In this case, it will create a folder on the root of your hard drive called 'moinwiki'.

    • (!) Note: 'moinwiki' may seem like an odd name, but there are a number 'moin' folders created, so I use 'moinwiki' to distinguish this folder from the others. You can of course name it anything you like.

    • <!> Security warning: Your wiki should not be in the "Sites" folder of your home folder, or in the /Library/!WebServer/Documents (Apache root) folder. Do not put your wiki folder where the web server can access it!

  4. Add yourself access privileges for moinwiki

  5. Apple tightened security in 10.5 Leopard. We want to add our username to the moinwiki folder so that it's easier to work with.

    1. right-click (control-click) on the moinwiki folder, and select "Get Info...".
    2. click the lock icon in the lower-right corner, enter your password to unlock.
    3. click the + icon to add a new user, from the dialog select your username.
    4. change your privileges to "Read & Write"

    5. click the gear icon and select "Apply to enclosed items".

The installation portion is now finished.


You are now ready to create a wiki instance! The following instructions will create a wiki called "mywiki". You may replace the name mywiki with almost any name you wish, but do not use wiki because that is used by MoinMoin for loading standard images and style sheets. Although this can be changed later, the name you choose for mywiki will become part of the url used to access your site, e.g.

Creating a Wiki Instance

We now want to create our own wiki instance and copy in a default set of templates and files. Do these commands:

cd /moinwiki/share/moin
mkdir mywiki
cp -r data mywiki
cp -r underlay mywiki
cp server/moin.cgi mywiki
cp config/ mywiki

You can repeat these steps for creating multiple instances, run these same commands again, substituting mywiki2 for mywiki.

Configuring Apache httpd.conf

Apple upgraded Apache to 2.2 in Leopard, which (among other things) brings tighter security controls than previous versions.

  1. Add yourself access privileges for apache2 (alternatively, if you're comfortable with commandline (, you can bypass these steps and use sudo and pico instead)

    1. From the Finder, under the 'Go' menu, select "Go to folder..." and type /etc.

    2. right-click (control-click) on the apache2 folder, and select "Get Info...".
    3. click the lock icon in the lower-right corner, enter your password to unlock.
    4. click the + icon to add a new user, from the dialog select your username.
    5. change your privileges to "Read & Write"

    6. click the gear icon and select "Apply to enclosed items".
  2. Edit Apache's configuration file, httpd.conf

    1. From the Finder, under the 'Go' menu, select "Go to folder..." and type /etc/Apache2. Drag the httpd.conf file onto

    2. Go to the end of the Aliases section and edit like the example below:

          Alias /moin_static160/   "/moinwiki/share/moin/htdocs/"
          ScriptAlias /mywiki      "/moinwiki/share/moin/mywiki/moin.cgi"

      Add the following to allow Apache to access your moinwiki directory (see for more help):

      <Directory "/moinwiki">
          Options Indexes FollowSymLinks MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
    3. Save changes
    4. Restart Apache -
      • open System Preferences, go to the Sharing page, select "Personal Web Sharing" and click "Stop" then "Start".
      • Alternatively, from, type apachectl graceful.

Configuring moin.cgi

The moin.cgi file essentially tells Apache to run all the moin wiki pages through the python interpreter.

  1. Edit the moin.cgi file at the following path /moinwiki/share/moin/mywiki/moin.cgi (click-drag the file onto Change the line that points to your file, like in the example below.

    sys.path.insert(0, '/moinwiki/share/moin/mywiki/')
  2. What to do if you get an "Internal Server Error"
    This most likely means that the pathname above is not correct.

    You can test your pathname by opening and pasting in the above line without the shebang #! statement (using the above example, /Library/Frameworks/Python.framework/Versions/2.5/bin/Python. If the path is correct, you should see output indicating your Python version as well as sample commands such as "help", "copyright", "credits", etc. If you get the error "Bad executable (or shared library)" or "No such file or directory" then the path is likely wrong, and you will need to correct. I've also noticed that it helps to point directly at the "python" executable, rather than the alias or symlinks found in the upper directories.


Open (click-drag the file onto and read the comments. The wiki you created is a new "Untitled Wiki", using the default configuration. You want to give a better name and setup some configuration values.

  • (!) Note that the file belongs to user and group www:www. You can edit the file as root, or change the group of the file to yourself with chown www:username

Edit /moinwiki/share/moin/mywiki/ and change the sitename to the name of your wiki:

    sitename = 'My Mac Wiki'

Additionally, set data_dir and data_underlay_dir to the absolute paths of the particular directories. You can use relative paths for the directories, but note that they are relative to the CGI script, not the configuration file! Better to use absolute paths, and save yourself some headaches:

    data_dir = r'/moinwiki/share/moin/mywiki/data'
    data_underlay_dir = r'/moinwiki/share/moin/mywiki/underlay'

Uncomment the url_prefix_static line:

    url_prefix_static = '/moin_static160'

For a public installation, you'll normally want to forbid some of the more dangerous actions. Add a line like this to

    actions_excluded = ['AttachFile', 'DeletePage', 'RenamePage', ]

Additional configuration details can be found in HelpOnConfiguration.

Setting Permissions

You have to make the web server the owner of the files in your wiki. Navigate to /moinwiki/share/moin/ and run the following commands:

chown -R www:www mywiki
chmod -R 744 mywiki

Testing Your New Wiki

In a web-browser surf to the site: http://localhost/mywiki You should see the FrontPage of your new wiki.

Now run the unit tests, to make sure everything is fine. Go to this address: http://localhost/mywiki?action=test

Windows Installation using Apache



Before you install MoinMoin, you must have the necessary infrastructure in place. This procedure explains the steps necessary to install the infrastructure and provides detailed instructions for the installation of MoinMoin.

Downloading and installing all of the required components will require almost 100 MB of disk space. The table below shows the approximate sizes of the various components.


Download MB

Installation MB










Many users prefer to install software products in a folder other than the installation default. Python typically changes the default installation folder name with each point release, and Apache has changed the default installation folder name with the release of version 2. Instead of enumerating all the possibilities at each step, this procedure will use the Reference name in the table below as the installed location for each product. Substitute your real installation location when editing configuration files and entering commands.



Installation Default or Typical Name



C:\Program Files\Apache Group\Apache2





wiki instances

C:\My Documents\Moin

This installation procedure was tested with Apache 1.3.26 and Apache 2.0.44 for Windows running on Windows/ME, and using Python 2.1, 2.2 and 2.3a.


MSI Installer

Installation of Apache and one alternative distribution of Python require the Microsoft MSI Installer. The latest version, 2.0, was released in September of 2001. You will know you don't have the correct version if you receive errors after double-clicking on a file name ending in .msi. To get the latest version, go to, search for msi installer, and follow the instructions. There are two versions, one for Windows/ME, 98, and 95; and another for Windows 2000 and NT. Windows/XP has the 2.0 version and requires no update.

WinZip, unzip, ...

MoinMoin is distributed in a zipped format for Windows users. Some versions of Windows are distributed with an unzip utility, many other Windows users rely on WinZip, a popular shareware program, available from There are many alternative compression utilities that are compatible with the .zip format. Since the .zip format is so commonly used for downloaded files, this procedure assumes you have a zip utility and know how to use it. If not, download WinZip or an alternative and review the instructions.


WinCVS is a GUI front end which can be used to retrieve MoinMoin module updates soon after they are committed to the SourceForge CVS system. Most users should never need to use this. If you really need a new MoinMoin feature that has just been committed to CVS now, and don't mind testing fresh code, then you can read more about it in MoinMoin:MoinMoinWinCvs.

You can install MoinMoin directly from your \CVSRoot\moin folder, just follow the installation instructions below as if you unzipped the current release into that folder. Note there is a potential problem if you instruct WinCVS to mark files with the Read-Only attribute. The setup program will not work correctly the second time you try to reinstall MoinMoin from \CVSRoot\moin because it will fail while attempting to overwrite the Read-Only files from the prior installation.

Installing Apache

To obtain the latest version of Apache, go to, and click on the link to HTTP Server. Find the link to download the Win32 Binary (MSI Installer) version. Read the Apache documentation to determine the correct installation procedure for your situation. Questions and problems with the Apache installation process should be resolved thru use of the resources provided by the Apache organization. Be sure your webserver runs correctly before proceeding.

Warning: the procedure described above tends to trivialize the installation of the Apache web server. Apache can be installed and running on your PC in a very few minutes with only a cursory examination of the Apache documentation. Before you undertake the installation of any web server that can be accessed through the internet, you should exercise a controlled level of paranoia and assess the potential damage that may be caused by hackers accessing or destroying sensitive data. This should include not only the all data which resides on the PC which will host the Apache web server, but all other PCs on the local LAN which participate in any form of file sharing.

Windows/ME, 98SE, 98, 95, and probably NT should be considered inappropriate hosts for any Apache web server that can be accessed via the internet. Use either Windows/2000 or XP and install all security patches available for your operating system.

Do not let the above discourage you from installing MoinMoin. Most of the internet activity probing your system for weaknesses will be from virus infected Windows/NT systems running IIS whose owners have neglected to apply available security patches. The starting Apache configuration is secure and you will not have a problem provided you:

  • Regularly review and apply security patches for your installed software.
  • Understand the ramifications of any changes you make to the Apache config files.
  • Regularly review the Apache logs for suspicious activity.
  • Regularly take backups of your data.

Installing Python

There are currently two different distributions of Python available for Windows. The normal Python distribution is available from This is distributed as a windows executable (.exe) file.

An alternative distribution called ActivePython is available from This distribution uses the MSI Installer and contains some tools specific to the Windows operating system and a popular Windows IDE called Pythonwin. ActivePython is available for free; an email address is requested (but not required) before downloading.

MoinMoin will work with either distribution, but requires Python release 2.0 or later. Download and install the distribution of your choice. Questions and problems dealing with the Python installation process should be resolved through the use of resources provided by or ActiveState. Be sure your Python installation is correct before proceeding.

Installing MoinMoin

Download the current version of MoinMoin from into C:\TEMP or an alternative location. Be sure to choose the version in the .zip format rather than the .tgz format.

Using your favorite unzip utility discussed above, unzip the MoinMoin distribution file into the same folder. You should then have a folder C:\TEMP\moin-x.x where "x.x" is the current release number. This folder will contain a file in addition to several other files and subfolders.

Open an MS-DOS or console window and enter the commands:

cd \TEMP\moin-x.x
C:\Python\python install --record=install.log

The above commands will add MoinMoin to your C:\Python installation and create an install.log file in C:\temp\moin-x.x listing all the copied files. You may use Windows Explorer to examine the newly created folders within C:\Python. You should find a C:\Python\share\moin folder with subfolders cgi-bin, data, and htdocs. If you have Python 2.0 or 2.1 you will find a folder C:\Python\MoinMoin, but with Python 2.2 and later it will be C:\Python\Lib\site-packages\MoinMoin. The MoinMoin folder contains many Python scripts and several subfolders.

You are now ready to create a wiki instance.

Creating a Wiki Instance

It is a good practice to try to keep all of your personal or site specific data under a few root folders. This way you can easily backup your important data on a regular basis without having to waste time either backing up static files or picking out dozens of important folders scattered throughout your folder structure. You should avoid placing your wiki data under the C:\Python folder so that you can later upgrade Python or MoinMoin without accidentally overwriting or deleting your wiki data. For the same reason, you probably don't want to place your wiki data within the C:\Apache folder. The default personal folder under many Windows versions is called C:\My Documents.

Choose a location appropriate for you; the following instructions assume you will be creating one or more wiki instances in C:\Moin\ and the first wiki instance will be named mywiki.

You may replace the name mywiki with almost any name you wish, but do not use wiki because that is used by MoinMoin for loading standard images and style sheets. Although this can be changed later, the plan is that the name you choose for mywiki will become part of the url used to access your site, e.g.

Start an MS-DOS or console window and enter the commands below. This will create a clone of the MoinMoin wiki in the mywiki folder. The wikidata folder will be used later for mywiki customization, such as logos and style sheets.

cd C:\
md Moin
md Moin\wikidata
md Moin\mywiki
md Moin\mywiki\data
cd \Python\share\moin
xcopy data        C:\Moin\mywiki\data /E
copy  cgi-bin\*.* C:\Moin\mywiki\*.*

If your server is going to run multiple wikis, you need to create additional clones. The commands below will create mywiki2. The wikidata folder created above can contain custom logos and style sheets for all your wikis.

cd C:\
md Moin\mywiki2
md Moin\mywiki2\data
cd \Python\share\moin
xcopy data        C:\Moin\mywiki2\data /E
copy  cgi-bin\*.* C:\Moin\mywiki2\*.*

Use your editor to edit the file C:\Moin\mywiki\moin.cgi. Change the first line (the shebang statement) to point to your local Python executable program. Note the forward slashes -- Apache uses the Unix convention for folder separators. This tells Apache the moin.cgi file is an executable script that will be interpreted by a program to be loaded from C:/Python/python.

The next step is to tell Apache that is has more work to do. Use your editor to append the following lines to C:\Apache\conf\httpd.conf.

Alias       /wiki/     "C:/Python/share/moin/htdocs/"
Alias       /wikidata/ "C:/Moin/wikidata"
ScriptAlias /mywiki    "C:/Moin/mywiki/moin.cgi"

The Alias lines for wiki and wikidata above instructs Apache to serve GIF images, style sheets, etc. from the specified folders and subfolders. The ScriptAlias line is needed once for each wiki instance, so if you have multiple wikis, repeat the statement using mywiki2, mywiki3, etc. The ScriptAlias statement instructs Apache to execute scripts from the specified folder. See the Apache docs for a complete explanation.

Test your changes by restarting your Apache server and try to access your newborn wiki with the URL You should see the FrontPage, try to edit and save it, and if that works, verify your edit is reflected on the RecentChanges page.

Finally, edit C:\Moin\mywiki\ and at least change sitename to the name of your wiki:

sitename = 'My Wiki'

If you want to replace the MoinMoin logo with one named mywikilogo.gif, copy your logo to C:\Moin\wikidata and change logo_url in as follows:

logo_url = '/wikidata/mywikilogo.gif'

For a personal or intranet installation, you'll normally also add this line to

allowed_actions = ['DeletePage', 'AttachFile']

Additional configuration details can be found in HelpOnConfiguration.

And now, it is up to you and your user community to transform your wiki into an informative and useful tool. You will probably want to retain most of the HelpOn~ pages dealing with editing, delete those pages with irrelevant information (like this page, don't let your users or boss know how easy it was to install MoinMoin ;) ), and rewrite the FrontPage to introduce your wiki topic.


The first place to look for clues when the unexpected happens is to try changing your url to: If Apache can find and execute the module C:/Moin/mywiki/moin.cgi, a page of diagnostics titled MoinMoin CGI Diagnosis will be displayed. Check the output for error messages.

The second place to look for is C:\Apache\logs\error.log. The following are common errors grouped by the message displayed by your browser.

Internal Server Error

If the Apache log shows a message "The system cannot find the file specified." then a possibility is the shebang statement in moin.cgi is incorrect.

If the Apache log shows a different error message, then the MoinMoin Python scripts may be abending. To determine the cause, you could try temporarily renaming moin.cgi to, loading with the Python idle IDE and executing it to determine if there are any error messages.

Not Found

If the Apache error log shows the message "File does not exist: C:/Apache/htdocs/mywiki", the ScriptAlias statement in httpd.conf may be incorrect.

The Page Cannot be found

If the Apache error log shows the message "File does not exist: C:/Apache/htdocs/????", you may have mistyped the url "" into your browser.

FrontPage Loads Without Icons

If the Apache Error log shows many error messages "File does not exist: C:/Apache/htdocs/wiki", then the Alias statement in httpd.conf may be incorrect.

Windows Installation using IIS



Before you install MoinMoin:MoinMoin, make sure you have the necessary infra-structure in place, namely the Internet Information Services webserver (any version should be OK), and a Python installation (version 2.0 or higher is recommended, don't run 1.5.2 without a compelling reason).

In the following description, we assume that you have installed or will install things to these locations:

  • IIS to its default location
  • C:\Python - the Python interpreter

  • C:\Moin - MoinMoin itself

Quite often, you might want to install things elsewhere, which is no problem at all; you just have to adapt any paths that appear in a command or config file to the locations you have chosen.

This installation procedure was tested with IIS 5 for Windows running on Windows 2000sp2, and using Python 2.2.


Installing IIS

You currently need an external webserver to run MoinMoin.

From Microsoft: (

  • To install IIS, add components, or remove components: Click Start, point to Settings, click Control Panel and start the Add/Remove Programs application. Select Configure Windows, click the Components button, and then follow the on-screen instructions to install, remove, or add components to IIS.

Make sure that your webserver runs without problems before you start to install MoinMoin; problems with your webserver installation are not in the scope of this document.

Installing Python

Download Python 2.1.2 and install it. Python installation is done via a standard Windows installer program.

Installing MoinMoin

Before creating a wiki instance, you have to download and install the basic MoinMoin software. We assume you already have downloaded the distribution archive to the "C:\TEMP" directory1.

Open a console window and enter the following commands:

cd \temp
cd moin-0.11
python install --prefix=C:\Moin --record=install.log

This will install all necessary files to the "C:\Moin" directory, and create a "install.log" file listing all the files that are created there.

  1. If you want to install the current development version from CVS, replace "C:\TEMP" with your "moin" working directory. (1)

Creating a Wiki Instance

You could run your wiki directly using the sample wiki created in "C:\Moin", but this is not recommended for two reasons:

  1. updating your wiki is more complicated and more dangerous.
  2. creating a second wiki instance, even if you currently don't plan for one, is much easier.

So, enter these commands in a console window:

cd \Moin
md mywiki
md mywiki\data
xcopy share\moin\data mywiki\data /E
copy share\moin\cgi-bin mywiki
copy share\moin\htdocs\index.html mywiki\default.htm

"mywiki" is the name of your wiki instance, you might want to chose a different name best fitting the intended use of this instance; just don't name it simply "wiki", because that would result in problems later on.

We have to make sure that moin.cgi can find the MoinMoin directory, so that "import MoinMoin" will work. You can either setup a PYTHONPATH environment variable which includes the installation path, but sometimes it can be tricky to make sure the variable will be set in the CGI environment. The easiest way to make sure MoinMoin can be imported is to append to sys.path within moin.cgi.

You can change the first two lines of code in moin.cgi to something like this:

   1 import sys
   2 sys.path.append(r'C:\Moin')

Notice that we're pointing to the directory which contains the MoinMoin directory, not the directory itself.

  • /!\ Python 2.2: Python 2.2 changed the installation layout. Because of this, you have to change the line of code given above to "sys.path.append(r'C:\Moin\Lib\site-packages')".

Next, you'll need to create two virtual directories in IIS. One for the shared data, and one for this specific wiki instance.

Go to Control Panel => Administrative Tools => Internet Information Service. Open up the tree to Default Web Site.

Right click on Default Web Site and choose New => Virtual directory. This will bring up a wizard with the manditory useless first screen, hit next. Enter "wiki" for the alias name and hit next. Browse to "C:\Moin\share\moin\htdocs" and hit next. Leave the Access permissions at their defaults and hit next. And now you're done, hit finish!

Now follow the same steps, but set the alias to "mywiki" and the path to "C:\Moin\mywiki".

Now you need to setup the 'mywiki' alias so that it will run Python to interpret .cgi files. Right click on your new 'mywiki' alias and choose Properties. On the first tab (Virtual Directory), click the Configuration button. The first tab is the App Mappings tab, which defines which programs to use for each file exetension. Click Add. Browse to your python.exe (probably something like c:\pythonXX\python.exe). Then add -u %s %s after the Python executable path. The Executable line will look something like this: C:\Python22\python.exe -u %s %s. In the Extension box enter .cgi with the begining period. Confirm that the Check that file exists option is not checked (if it is, MoinMoin won't be able to display sub pages). Ok, you're done with the alias configuration, click OK several times to get back out of all the dialog boxes.

If you add another wiki instance, you'll only need to setup the reference to its folder, they can safely share the "wiki" alias which points to static files only.

That is all, try to access your new-born wiki with the URL "". You should see the FrontPage, try to edit and save it, and if that works, see if your edit is reflected on the RecentChanges page.

Finally, edit "" and at least change "sitename" and "logo_url" to some personal values:

sitename = 'My Wiki'
logo_url = '/images/mywiki-logo.gif'

For a personal or intranet installation, you'll normally also add the line

allowed_actions = ['DeletePage', 'AttachFile']


If you see an error like "ImportError: No module named MoinMoin", it means that python cannot find MoinMoin. See above for how to set your PYTHONPATH or add to sys.path.


Built-in test

There's a built-in diagnostic mode that's useful when doing an install; just append "?test" to the URL of your wiki:

lynx --dump http://`hostname`/mywiki?test

If you see an import error here, but "python -c "import MoinMoin"" works, it's likely a result of missing file permissions or a wrong PYTHONPATH setting within the web server environment.