Ruby on Rails
FastCGI on unix linux bsd

Here’s a step-by-step guide for making Rails work with \FastCGI?. There’s a special version for \FastCGIOnFedora

If you are using Apache you will need mod_fcgi, and the \FastCGI Development kit; These can be obtained from http://www.fastcgi.com . You will also need ruby-fcgi.

  1. Install the FastCGI? Devel kit.
    $ wget <a href="http://fastcgi.com/dist/fcgi-2.4.0.tar.gz">http://fastcgi.com/dist/fcgi-2.4.0.tar.gz</a> 
    $ tar zxvf fcgi-2.4.0.tar.gz
    $ cd fcgi-2.4.0
    $ ./configure
    $ make
    $ sudo make install
  1. Install ruby-fcgi (note that on some systems this won’t work right unless you’ve installed the Devel kit first).
    $ sudo gem install fcgi
  1. Download and install mod_fcgi from your distributions package management system of choice (\ToDo: expand on this)
  1. Add the following to your apache httpd. conf
    LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so
    <IfModule mod_fastcgi.c>
        FastCgiIpcDir /tmp/fcgi_ipc/
        AddHandler fastcgi-script .fcgi
    </IfModule>

    You may have mod_fastcgi.so installed in a different place. If so, use the correct path.
  1. Reload apache with
    $ apache2ctl reload

    Use apachectl if you are not using apache2
  1. Change directories to your rails app
  1. In public/dispatch.fcgi change:
    require 'fcgi'

    to
    require 'rubygems'
    require_gem 'fcgi'
  1. In public/.htaccess change:
    RewriteRule ^(.*)$ /dispatch.cgi [QSA,L]

    to
    RewriteRule ^(.*)$ /dispatch.fcgi [QSA,L]

Credits

Thanks to Jarkko Laine