Upgrading from FastCGI to mod_wsgi
Sorry, this is a bit Windows-oriented, but it applies universally...
Why?
You may be asking yourself, "Why should I switch to mod_wsgi, when FastCGI is working perfectly fine?" Good question, mod_wsgi offers...
faster performance - In my informal testing, mod_wsgi performed consistantly the same or slightly faster than FastCGI. This was determined by turning on show_timings. Granted, the difference was so small that in the real world, no one will ever really notice the difference, but also consider below...
It's the recommended accelerator by the Moin developers - mod_wsgi is a "native" Python web API for Apache, which makes me feel warm and fuzzy inside. And, as of Moin version 1.9, Moin is now a fully native wsgi application.
easier to set-up, and a simpler configuration - since mod_wsgi lives as an Apache extention, you don't need to use the Windows Resource Kit to go through the trouble ofsetting up FastCGI to run as a Windows service, etc.
easier future upgrades - With FastCGI, each time there's an upgrade, Windows users have to remember to go spelunking into the python code to switch the port number. No more with mod_wsgi, we're much closer to "it just works".
And, with all of the above, it's easy to switch!
How?
First download & copy files around to where they belong:
Download the pre-built Windows binary from the mod_wsgi site.
look for the link to "binaries (Windows)", download the latest version (2.7 or later as of this writing), make sure the version you download matches the version of Apache you have.- Uncompress and copy into the Apache 'modules' directory (typically at c:\Program Files\Apache Group\Apache2\modules\)
From the D:\Python25\share\moin\server\ directory, copy the moin.wsgi file into your Moin data directory (same spot as where your working data directory is, along with the moin.cgi or moin.fcg file is).
Second, edit various configuration files:
Open your Apache httpd.conf file:
find the "LoadModules" section and add
LoadModule wsgi_module modules/mod_wsgi.so
b. Scroll to the end of your httpd.conf file, comment out your ScriptAlias line and add a WSGIScriptAlias line, similar to this:
#ScriptAlias /mywiki "D:/moin/moin.fcg" WSGIScriptAlias /mywiki "D:/moin/moin.wsgi"
Open your moin.wsgi file (generally found around d:\moin)
in the a2 section, add (make sure it's uncommented):
# a2) Path of the directory where wikiconfig.py / farmconfig.py is located. sys.path.insert(0, 'D:\moin')
Clean-up the old FastCGI
When you're tested and confortable that everything is working properly, you can un-install the unneeded FastCGI, if you want.
Open your Apache httpd.conf file:
Comment out (or remove):
#LoadModule fastcgi_module modules/mod_fastcgi.dll
and
#FastCgiExternalServer d:/Moin/moin.fcg -host 127.0.0.1:9001
and
#ScriptAlias /mywiki "D:/moin/moin.fcg"
If you followed the instructions on Windows FastCGI, you've installed FastCGI as a service. You can now use instsrv.exe to remove the service.
INSTSRV WikiFastCGIservice remove