Steps to setup Moin for your Apache server
==========================================

These instructions are only an example, please refer to the upstream-supplied
documentation files in this package, http://moinmo.in/ and
http://code.google.com/p/modwsgi/ for more instructions on setting up Moin and
mod_wsgi.

It's very important to read the documentation in /usr/share/doc/moin-*,
especially when upgrading to a newer version of this package! 'rpm -qd moin'
should give a list of the documentation files in this package.

Set up a wiki instance
----------------------

First you need a wiki instance, which can be set up as follows:

#!/bin/sh
DESTDIR=/var/www/mywiki
mkdir -p $DESTDIR
cp -a /usr/share/moin/{data,underlay,htdocs} $DESTDIR
chown -R apache:apache $DESTDIR/{data,underlay,htdocs}

These instructions also copy the htdocs directory, which includes the static
content, such as images, themes, favicon.ico and robots.txt. You can also use
the /usr/share/moin/htdocs directory, but that prevents you from editing the
favicon or robots.txt or adding new themes. Another option is to symlink
the files and directories you can use from /usr/share/moin/htdocs and only
copy the files you need to edit.

Set up Moin using mod_wsgi
--------------------------

This is the recommended way of using Moin with Apache. First install the
mod_wsgi package from Fedora's package repository.

Remember to change the line Alias /moin_static182/ "$DESTDIR/htdocs/"
according to the Moin version. For example 182 is for Moin version 1.8.2.

#!/bin/sh
DESTDIR=/var/www/mywiki
mkdir -p $DESTDIR/config
cp -a /usr/share/moin/server/moin.wsgi $DESTDIR/config
cp -a /usr/share/moin/config/wikiconfig.py $DESTDIR/config
cat > /etc/httpd/conf.d/mywiki.conf <<EOF
# this is for icons, css, js (and must match url_prefix from wiki config):
Alias /moin_static182/ "$DESTDIR/htdocs/"
<Directory "$DESTDIR/htdocs/">
    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
# this is the URL http://servername/mywiki/ you will use later to invoke moin:
WSGIScriptAlias /mywiki "$DESTDIR/config/moin.wsgi"
<Directory "$DESTDIR/config">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
# The WSGI socket needs to be somewhere Apache has access to
WSGISocketPrefix /var/run/moin-wsgi
# in case you want your wiki under the root url (http://servername/), use this instead:
#Alias /robots.txt $DESTDIR/htdocs/robots.txt
#Alias /favicon.ico $DESTDIR/htdocs/favicon.ico
#WSGIScriptAlias / $DESTDIR/config/moin.wsgi
# create some wsgi daemons - use someuser.somegroup same as your data_dir:
WSGIDaemonProcess moin user=apache group=apache processes=5 threads=10 maximum-requests=1000 umask=0007 display-name=wsgi-moin
# use the daemons we defined above to process requests!
WSGIProcessGroup moin
# This is required if you plan to use HTTP authorization. Without it the user name won't
# be passed to MoinMoin. 
#WSGIPassAuthorization On
EOF

Edit /var/www/mywiki/config/moin.wsgi and add
sys.path.insert(0, '/var/www/mywiki/config') after the comment lines.

Edit /var/www/mywiki/config/wikiconfig.py to have something like the
following (it's Python, spaces and quotes matter):
    data_dir = '/var/www/mywiki/data/'
    data_underlay_dir = '/var/www/mywiki/underlay/'

Finally do a "service httpd restart".

Set up Moin using CGI
---------------------

This is quite slow, using mod_wsgi is recommended.

Remember to change the line Alias /moin_static182/ "$DESTDIR/htdocs/"
according to the Moin version. For example 182 is for Moin version 1.8.2.

#!/bin/sh
DESTDIR=/var/www/mywiki
mkdir -p $DESTDIR/cgi-bin
cp -a /usr/share/moin/server/moin.cgi $DESTDIR/cgi-bin
cp -a /usr/share/moin/config/wikiconfig.py $DESTDIR/cgi-bin
cat > /etc/httpd/conf.d/mywiki.conf <<EOF
ScriptAlias /mywiki "$DESTDIR/cgi-bin/moin.cgi"
<Directory "$DESTDIR/cgi-bin/">
    Options ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
Alias /moin_static182 "$DESTDIR/htdocs/"
<Directory "$DESTDIR/htdocs/">
    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
EOF

Edit /etc/httpd/conf/httpd.conf to include "AddHandler cgi-script .cgi".
Edit /var/www/mywiki/cgi-bin/wikiconfig.py to have something like the
following (it's Python, spaces and quotes matter):
    data_dir = '/var/www/mywiki/data/'
    data_underlay_dir = '/var/www/mywiki/underlay/'

Finally do a "service httpd restart".

