HelpOnInstalling/FastCgiFastCGI 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. /!\ Follow the basic installation for your operating system as described in other parts of the MoinMoin installation documentation. This is HelpOnInstalling/BasicInstallation and HelpOnInstalling/WikiInstanceCreation, or HelpOnInstalling/ApacheOnLinux in most cases. Using MoinMoin with FastCgiFor more general information: - FastCGI Homepage FastCGI — The Forgotten Treasure (introduction) Deploying on ApacheTo 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 optionsNo 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. Example for Apache2 on DebianEdit the /etc/apache2/conf.d/your_wiki:
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: 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: Select a port number for the internal communication. It should be larger than 1023. For this example, we chose 8888 (just for fun). Add the following lines to your httpd.conf:Edit moin.fcg
. Replace with Start the file moin.fcg
manually like a Python script:Start Apache. Fallback to CGI if FastCGI is not availableInstall 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:
ScriptAlias /mywiki "/your/path/to/moin.cgi"
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 lighttpdThis 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): Then configure it to run moin.fcg for your wiki site and also serve the static stuff: "/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" => "127.0.0.1",
"port" => 3060,
"check-local" => "disable",
))
)
}
}]]>Finally adapt moin.fcg: Using HTTP Authenticationlighttpd 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 scriptHere is a startup script for Mac OS X, using DarwinPortsStartup system. It is probably useful for other unix like platforms. /dev/null
}
]]> /dev/null
}
]]>&2
;;
esac
]]>Mac OS X: Adding MoinMoin startup scriptWith this script, moin instances will be started automatically on startup. Install darwinports Install DarwinPortsStartup package: Copy moin.sh into /opt/local/etc/rc.d
: