The following 315 words could not be found in the dictionary of 615 words (including 615 LocalSpellingWords) and are highlighted below:

a2enmod   above   according   add   Add   Adding   advantage   Alias   all   All   allocate   allow   alternative   an   and   answers   Apache   apache   Apache2   apache2   apache2ctl   application   apt   assigning   automatically   available   balance   basename   basic   Be   be   because   best   between   bin   block   break   broken   bug   build   by   cached   can   case   cases   cat   cd   changed   changes   check   chose   clear   communicate   communication   conf   config   Configuration   configuration   configured   Contents   cp   cpus   Darwin   darwinports   Debian   delegated   depends   deploy   Deploying   described   dev   different   disable   distinct   docroot   Documentation   documentation   Don   don   done   each   echo   Edit   effect   either   enable   enables   enhancing   errors   esac   etc   Example   example   exit   Expand   external   External   fail   Fallback   Fast   fastcgi   faster   fcg   fcgi   file   File   files   follow   Follow   following   For   for   forget   from   fun   get   getdp   graceful   group   handle   handled   Handler   hardware   having   Help   hidden   host   Host   how   httpd   idle   if   If   Import   In   in   initialized   Install   install   installation   installed   Installing   instance   instances   instead   internal   into   its   itself   just   key   kill   larger   later   leaving   libapache2   lighttpd   like   lines   Linux   little   load   local   localhost   log   long   lot   Mac   make   manually   max   memory   method   min   mod   module   Module   most   Multiple   multiple   mywiki   need   Normally   Now   null   number   numbers   Of   of   On   on   one   only   opendarwin   operating   opt   option   options   or   other   otherwise   own   package   parts   path   performance   pid   places   platforms   Please   port   ports   Ports   probably   process   processes   procs   python   Python   rc   reason   refer   refers   remove   Replace   request   respond   restart   rm   root   run   Running   running   same   satisfied   Script   script   scriptfilename   scripts   see   seems   Select   server   Server   sh   should   slow   socket   spawn   specify   Start   start   started   Starting   starting   Startup   startup   stderr   stop   successive   sudo   suexec   sure   system   Table   task   test   Tested   than   that   The   the   them   then   Then   thfcgi   This   this   time   timeout   to   To   trick   Try   twice   unix   Usage   Use   use   useful   user   Using   using   usr   via   Virtual   want   we   web   well   when   where   which   will   Windows   With   with   won   working   works   Wrapper   wrapper   You   you   your  


Using MoinMoin with FastCgi

FastCGI is a method which enables apache 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.

Deploying on Apache

To deploy MoinMoin using FastCGI you need an apache with mod_fastcgi. Please refer to the documentation of mod_fastcgi how to build it.

Follow the basic apache installation for your operating system as described in other parts of the MoinMoin installation documentation. This is HelpOnInstalling/ApacheOnLinux in most cases. 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 (see 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!

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

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.THFCGI(handle_request)


    fcg = thfcgi.THFCGI(handle_request, 0, 8888)
  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

The best option is to run moin as external application. In this case, you don't need to restart the web server when you want to restart moin.


fastcgi.server = ( "/mywiki" =>
                       ( "localhost" =>
                           "host" => "",
                           "port" => 8888,
                           "check-local" => "disable",
                           "broken-scriptfilename" => "enable",
  • (!) You will see a lot of "2005-12-02 16:30:11: (mod_fastcgi.c.2373) FastCGI-stderr:" errors in

lighttpd's error log, the reason is not clear.

Starting MoinMoin instance

To start a MoinMoin instance, either follow the changes in "Running as an external application and/or on Windows" above, or run moin.fcg using spawn-fcgi (installed with lighttpd).

cd /www/org.mywiki/bin
sudo -u www /usr/local/bin/spawn-fcgi -f ./moin.fcg -P

To stop the instance later:

sudo kill `cat`
  • (!) Running spawn-fcgi as root and using -u www -g www fail because of Python ImportError, the reason is not clear. sudo -u www seems to have to same effect.

Multiple moin processes

If you start multiple moin instances on different ports, lighttpd balance the load automatically between them, using all the cpus.

Use this configuration:

fastcgi.server             = ( "/mywiki" =>
                               ( "localhost" =>
                                 ( "host" => "", 
                                   "port" => 1080,
                                   "check-local" => "disable",
                                   "broken-scriptfilename" => "enable",
                                 ( "host" => "", 
                                   "port" => 1081, 
                                   "check-local" => "disable",
                                   "broken-scriptfilename" => "enable",

Multiple moin processes automatically started by lighttpd

As an alternative to manually starting multiple processes of moin.fcg and assigning a distinct TCP port to each, this task can be delegated to lighttpd itself. The key is to specify "bin-path" option to fastcgi.server, and to allow multiple moin.fcg processes to be started as configured by "min-procs" and "max-procs" options. The hidden trick is that lighttpd will allocate successive TCP port numbers to each process, starting with "port". Tested with lighttpd 1.4.10.


fastcgi.server = (  "/mywiki" =>
  (( "docroot"   => "/",
     "min-procs" => 4,
     "max-procs" => 4,
     # allocate successive port numbers for each process, starting with "port"
     "bin-path"  => "/usr/local/bin/moin.fcg",
     "host"      => "",
     "port"      => 2200,
     "check-local" => "disable",
     "broken-scriptfilename" => "enable",

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

Adding MoinMoin startup script on Mac OS X

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