1. install FastCGI
download a tarball from http://www.fastcgi.com/, make and install.
2. install mod_fcgid
you should have a precompiled package for your distribution. get it.
3. install ruby-devel package
fcgi gem (see next step) requires ruby-devel package, which is the
collection
of include files and libraries needed to compile ruby-powered
binaries.
it should be in the distribution's package repository.
4. install fcgi gem
$ gem install fcgi -- --with-fcgi-include=/usr/local/include
--with-fcgi-lib=/usr/local/lib
specify `include' and `lib' directory in which you installed
ruby-devel package.
5. spawn a new rails project
$ rails foo
6. change permissions of some files
change permission of files/directories below so that Apache will be
allowed write access.
log/
tmp/
tmp/*
7.configure apache
example:
LoadModule rewrite_module /usr/lib/apache2-prefork/mod_rewrite.so
LoadModule fcgid_module /usr/lib/apache2/mod_fcgid.so
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
IPCCommTimeout 40
IPCConnectTimeout 10
DefaultInitEnv RAILS_ENV development
SocketPath /tmp/fcgidsock
</IfModule>
<VirtualHost *:80>
ServerName foo.example.com
DocumentRoot /path/to/foo/public
</VirtualHost>
<Directory /path/to/foo>
Options ExecCGI FollowSymLinks
AllowOverride none
RewriteEngine On
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</Directory>
8. modify dispatch.fcgi
add lines below to /path/to/foo/public/dispatch.fcgi
require 'rubygems'
gem 'fcgi'
that's it!
other resource:
http://wiki.rubyonrails.com/rails/pages/HowtoSetupA
pacheWithFastCGIAndRubyBindings