Configuring Moin with FastCGI (dynamic application mode)
========================================================
This is the preferred way to use moin, as it is much faster than using
mod_python, and more secure than external application mode since the wiki
application runs in an SELinux confined domain.
This approach requires mod_fcgid:
http://fastcgi.coremail.cn/
An RPM package for this is currently under review for inclusion in Fedora
Extras: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=195666
Setting up moin with mod_fcgid is very similar to setting it up as a regular
CGI application.
* Create a directory for your wiki instance:
DESTDIR=/var/www/mywiki
mkdir -p $DESTDIR/cgi-bin
* Copy in the wiki template data and the application itself:
cp -a /usr/share/moin/{data,underlay} $DESTDIR
cp -a /usr/share/moin/server/moin.fcg $DESTDIR/cgi-bin
cp -a /usr/share/moin/config/wikiconfig.py $DESTDIR/cgi-bin
* Fix the directory ownership
chown -R apache:apache $DESTDIR/{data,underlay}
* Edit $DESTDIR/cgi-bin/wikiconfig.py to suit your needs
* Create a httpd configuration file for the wiki, e.g.
/etc/httpd/conf.d/mywiki.conf
# Wiki application data common to all wiki instances
Alias /wiki/ "/usr/share/moin/htdocs/"
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# Wiki instance with mod_fcgid
ScriptAlias /mywiki "/var/www/mywiki/cgi-bin/moin.fcg"
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
* If you are using SELinux, set the file contexts appropriately
(this assumes you are using the SELinux policy module included
with the mod_fcgid package):
cd /var/www/mywiki
chcon -t httpd_fastcgi_content_t $DESTDIR
chcon -R -t httpd_fastcgi_script_exec_t $DESTDIR/cgi-bin
chcon -R -t httpd_fastcgi_script_rw_t $DESTDIR/{data,underlay}
It is necessary to turn on the httpd_enable_cgi boolean to run either
regular or FastCGI scripts:
setsebool -P httpd_enable_cgi 1
* Restart the web server to load the new configuration:
service httpd restart
Configuring Moin with FastCGI (external application mode)
=========================================================
Documentation can be found at:
http://moinmoin.wikiwikiweb.de/HelpOnInstalling/FastCgi
This approach requires mod_fastcgi:
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html
Configuring Apache:
As per setting up moin in regular CGI mode, or using mod_python, you'll need
in your httpd conf file:
Alias /wiki/ "/usr/share/moin/htdocs/"
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
This provides support for all modes of operation, and is common to all wiki
instances.
Creating a wiki instance (mywiki, located in /var/www/mywiki):
mkdir -p /var/www/mywiki/cgi-bin
cp -a /usr/share/moin/{data,underlay} /var/www/mywiki
cp -a /usr/share/moin/server/moin.fcg /var/www/mywiki/cgi-bin
cp -a /usr/share/moin/config/wikiconfig.py /var/www/mywiki/cgi-bin
chown -R apache:apache /var/www/mywiki/{data,underlay}
Edit /var/www/mywiki/cgi-bin/moin.fcg and replace:
fcg = thfcgi.THFCGI(handle_request)
with:
fcg = thfcgi.THFCGI(handle_request, 0, 8888)
where 8888 is the TCP port number you are using for communications between
the web server and the moin application. The choice of port number is fairly
arbitrary but must be 1024 or higher.
Fix the SELinux contexts of the wiki files:
chcon -R system_u:object_r:httpd_sys_script_exec_t /var/www/mywiki/cgi-bin
chcon -R root:object_r:httpd_sys_script_rw_t /var/www/mywiki/{data,underlay}
The moin application itself runs unconfined, which is rather a big security
issue and unlikely to be fixed any time soon. This is a good reason to use
the dynamic application with mod_fcgid method instead.
The SELinux boolean httpd_can_network_connect will need to be set so that
httpd can communicate with the moin application:
setsebool -P httpd_can_network_connect 1
Edit /var/www/mywiki/cgi-bin/wikiconfig.py as needed.
Create /etc/sysconfig/moin-fastcgi from the moin.sysconfig example in the
fastcgi directory, including details of your wiki instance:
WIKI_COUNT=1
WIKI_NAME[1]="My Wiki"
WIKI_FCGI[1]=/var/www/mywiki/cgi-bin/moin.fcg
WIKI_PORT[1]=8888
In your httpd conf file, add:
Alias /mywiki "/var/www/mywiki/cgi-bin/moin.fcg"
FastCgiExternalServer "/var/www/mywiki/cgi-bin/moin.fcg" -host localhost:8888
You will of course need to use a different port for each wiki instance you
run.
Copy moin.init from the fastcgi directory to /etc/rc.d/init.d/moin-fastcgi
Starting and stopping the moin applications:
service moin-fastcgi start
service moin-fastcgi stop
To have the service start automatically at boot time:
chkconfig --add moin-fastcgi
chkconfig moin-fastcgi on
Having created a new wiki instance, restart apache:
service httpd restart