Published January 1st, 2006

Many people know about the old school mod_fastcgi, but very few know about mod_fcgid. To put it extremely briefly, if you are using Apache 2, and you should be, you should be using modfcgid, and not modfastcgi.

Here quick guide on how to configure mod_fcgid for use with Apache HTTPD 2.2.0 and Typo, a RoR blog engine:

  • Download and Prepare mod_fcgid

wget tar -xvzf modfcgid.1.07.tar.gz cd modfcgid.1.07

  • Edit the Makefile. Change the _top_dir variable to the prefix of your Apache 2 install.
  • Apply this patch for mod_fcgid:
patch -p0 < mod_fcgid.1.07-apache2.2.0.patch

This patch has been submitted upstream, and should be part of the next release.

  • Run ‘make’.
  • Copy .libs/modfcgid.so_ to your Apache modules directory
  • Add the following to your httpd.conf, to load the module:
LoadModule fcgid_module modules/ 
IPCCommTimeout 40
IPCConnectTimeout 10
  • Configure mod_fcgid for your Rails Application:
<VirtualHost *:80>
# Insert the rest of your vhost config here.

<Location /journal>
    RewriteEngine On
    # Let apache handle purely static files like images by itself.
    RewriteCond %{REQUEST_FILENAME} !-f
    # Send Everything else to Typo
    RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] 

<Directory /sites/>
    # ExecCGI is required for mod_fcgid to work.
    Options Indexes FollowSymLinks ExecCGI
    # Disable .htaccess files.
    AllowOverride None
    Order allow,deny
    Allow from all
    # This tells mod_fcgid to run the dispatch.fcgi script as a FastCGI
    AddHandler fcgid-script .fcgi
  • Thats it.

This whole process can be easier, since modfcgid is also in many packaging systems, including [FreeBSD’s Ports](, and Gentoo Portage.

Written by Paul Querna, CTO @ ScaleFT. @pquerna