Revision 5 - 2008-12-02 at 05:50:27

h1. MojoMojo Running via External FastCGI

h2. Overview

MojoMojo is avant-garde wiki software that uses the Catalyst Framework and a buttload of CPAN modules. External FastCGI is useful for separating the application processes from the web server. MojoMojo, being a Catalyst application, gives you a FastCGI enabled application for free. Once you've gotten MojoMojo installed, it's easy as pie to configure apache to use external FastCGI instances of MojoMojo. Read on to find out how.

h2. FastCGI

h3. Overview

FastCGI is an CGI done right. It is designed to improve peformance and scalability of CGI. A distinct advantage of running FastCGI instances in their own process space is the separation of application processes from the web server. Thus application restarts don't require web server restarts which is real handy for times when the site is busy but the application must be restarted.

h3. Configuration

  • Perl Modules: FCGI and FCGI::ProcManager
  • Apache module: mod_fastcgi - installed from debian package: libapache2-mod-fastcgi
  • Enable the module with fastcgi.load and fastcgi.conf - start with nothing in fastcgi.conf
  • fastcgi.conf has handler directive: AddHandler fastcgi-script .fcgi - this is not needed for this example
  • add to a conf file: Use FastCGI in separate process on distinct host (local or remote)
FastCgiExternalServer /var/www/virtual-file.fcgi -host
Alias /cia-wiki/ /var/www/virtual-file.fcgi/

The directories must exist but the filename is arbitary[1].

  • Start the fastcgi processes: -l :3001 -n 3 -p /home/hunter/ -d

This starts 3 fastcgi instances on port 3001, puts a process id in the file and puts fastcgi in daemon mode.

  • Kill fastcgi processes: kill -TERM first process. Use -p option when starting to specify pid file.

h2. Make an init script

I have not tested it yet, but it appears an init script for starting FastCGI Catalyst app. can be created using Catalyst::Helper::FastCGI::ExternalServer. Another possibility for managing FastCGI processes is FCGI::Engine::Manager

h2. Addendum

A much more in-depth article about using external FastCGI server with Catalyst applications is available at

h2. Foot Notes

fn1. The absolute path must exist and be readable by the fastcgi process, but the filename at the end is virtual (just used for mapping of fastcgi process to the URI) so it can be anything.

My tags:
Popular tags:
Powered by Catalyst