Using MoinMoin with fcgid & suexec on Apache 2.2

(Version française)

In short

This page summaries a working setup of MoinMoin on Apache, using fcgid and suexec. It has been tested with Apache 2.2 on a Debian Linux system.

We use 2 domain names, wiki.example.org, used to access the wiki, and static.example.org, which gives access to the static elements, and will not be accessed directly.

Installation procedure

Customisation

You need to adapt the following values to your own setup:

Apache 2 setup

Enable the fcgid et suexec Apache modules. If you're using a Debian, this can be done with the following commands:

a2enmod suexec
a2enmod fcgid

Modifiy your virtuals hosts as follows:

<VirtualHost *>
ServerName wiki.example.org

[...]

Options None

Alias /robots.txt  /usr/share/moin/htdocs/robots.txt
Alias /favicon.ico /usr/share/moin/htdocs/favicon.ico
ScriptAliasMatch ^/(.*) /var/www/user_account/moin.fcg/$1

SuexecUserGroup user_account user_group
IdleTimeout 60
IPCCommTimeout 180
DefaultMaxClassProcessCount 1
DefaultMinClassProcessCount 1

<Location />
  AddHandler fcgid-script .fcg
  Options ExecCGI
</Location>

</VirtualHost>

<VirtualHost *>

ServerName static.example.org
DocumentRoot /usr/share/moin/htdocs

[...]

UseCanonicalName On
Options None

</VirtualHost>

You may need to adjust the value of the IPCCommTimeout, depending on your server speed. You will need to add some time to this value if saving large pages fails with an "Internal error".

You now need to check that you Apache is correctly set up:

apache2ctl -t

Directory preparation

Unless you use the mod_userdir Apache module, your MoinMoin installation will need to be in a subdirectory of /var/www.

Create the directories that will host your wiki:

mkdir -p /var/www/user_account/MoinMoin

Then, install MoinMoin in this new directory.

FCGI script

Place the moin.fcg script, from the wiki/server directory, on the /var/www/user_account directory.

Replace the line:

# Path of the directory where wikiconfig.py is located.
# YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.
sys.path.insert(0, '/path/to/wikiconfig')

By:

# Path of the directory where wikiconfig.py is located.
# YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.
sys.path.insert(0, '/var/www/user_account/MoinMoin')

MoinMoin settings

Update the wikiconfig.py file with the following informations:

data_dir = '/var/www/user_account/MoinMoin/data'
data_underlay_dir = '/var/www/user_account/MoinMoin/underlay'
url_prefix = 'http://static.example.org'

Permissions update

Apply the following permissions:

# User account directory

chown user_account:user_group /var/www/user_account
chmod u=rwx,g=rx,o=rx /var/www/user_account

# Wrapper script

chown user_account:user_group /var/www/user_account/moin.fcg
chmod u=rwx,ug= /var/www/user_account/moin.fcg

# Site (for added security, no access is given to the web server)

chown -R user_account:user_group /var/www/user_account/MoinMoin
chmod -R u=rwX,go= /var/www/user_account/MoinMoin

Restart Apache

Everything should be OK now, you just need to restart Apache:

apache2ctl graceful

See also


Creative Commons License