This explains how to deploy Rails
application using Apache and FastCGI.
Install ruby,gems,rails,databse and make a testapp ready. Test this
with the rails in-buit server ‘Webrick’. If you have not done this
before,refer http://www.arthurneil.com/rails-deployment-scgi/rails-deployment-scgi
Now lets start with Fastcgi and Apache.
Install the following
wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar -xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make
make install
gem install fcgi
wget http://rubyforge.org/frs/download.php/11368/ruby-fcgi-0.8.7.tar.gz
tar -xzvf ruby-fcgi-0.8.7.tar.gz
cd ruby-fcgi-0.8.7
ruby install.rb config
ruby install.rb setup
ruby install.rb install
wget http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0404142202.tar.gz
tar -xzvf mod_fastcgi-SNAP-0404142202.tar.gz
cd mod_fastcgi-SNAP-0404142202
wget
http://www.fastcgi.com/archives/fastcgi-developers/2005-December/004060.html
tail +55 004060.html | head -52 | sed ’s/&/\&/g’ >
ap22.patch
patch -p 1 < ap22.patch
cp Makefile.AP2 Makefile
make
make install
mkdir /mnt/fcgi_ipc/
chmod 777 /mnt/fcgi_ipc/
If you get any permission error to store session details.
chown of tmp/ and log/ folders.
Make your Apche configuration file(httpd.conf) to look like this.
LoadModule fastcgi_module /usr/local/apache2/modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiWrapper on
FastCgiConfig -idle-timeout 900
FastCgiIpcDir /mnt/fastcgi_ipc/
FastCgiServer /usr/local/railsapps/testapp/public/dispatch.fcgi
-initial-env RAILS_ENV=production -processes 10
AddHandler fastcgi-script .fcgi .rb
</IfModule>
<VirtualHost *>
DocumentRoot /usr/local/railsapps/testapp/public/
<Directory /usr/local/railsapps/testapp/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi .fcg .fpl
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>
Restart Apache. You are done.
