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...

And, with all of the above, it's easy to switch!


How?

  1. First download & copy files around to where they belong:

    1. 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.

    2. Uncompress and copy into the Apache 'modules' directory (typically at c:\Program Files\Apache Group\Apache2\modules\)
    3. 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).

  2. Second, edit various configuration files:

    1. Open your Apache httpd.conf file:

      1. 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"
    2. Open your moin.wsgi file (generally found around d:\moin)

      1. 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.

  1. Open your Apache httpd.conf file:

    1. Comment out (or remove):

      #LoadModule fastcgi_module modules/mod_fastcgi.dll
    2. and

      #FastCgiExternalServer d:/Moin/moin.fcg -host 127.0.0.1:9001
    3. and

      #ScriptAlias /mywiki        "D:/moin/moin.fcg"
  2. 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

MoinMoin: RickVanderveer/UpgradingFromFastCGItoModWSGI (last edited 2010-02-14 11:06:07 by ThomasWaldmann)