Using rails with apache2 and fastcgi, multisite In RubyOnRails, 974 days ago 

sudo apt-get install libapache2-mod-fastcgi

sudo apt-get install libfcgi-dev

sudo gem install fcgi

sudo a2enmod fastcgi

You can configure the fastcgi module, editing /etc/apache2/mods-enabled/fastcgi.conf

<IfModule mod_fastcgi.c>
  AddHandler fastcgi-script .fcgi
  FastCgiIpcDir /var/lib/apache2/fastcgi
  FastCgiConfig -maxClassProcesses 2 -maxProcesses 2 -minProcesses 2 -processSlack 2
</IfModule>

Now add a specific fastcgi server for each application

<IfModule mod_fastcgi.c>
  FastCgiServer /home/www/mysite/public/dispatch.fcgi -idle-timeout 120 -processes 2 -initial-env RAILS_ENV=development
</IfModule>

You CANNOT define the FastCgiServer inside a VirtualHost directive (unless you’re using Apache 1.3, it seems…)

Be sure to have a AddHandler fastcgi-script .fcgi in your .htaccess

mod_fastcgi documentation.

Apache tuning for Rails and fastcgi

Ruby on Rails and FastCGI: Scaling using processes instead of threads

Comments

  1. David Winter said:

    Should FastCGI be used over fcgid?

    Is it safe to install it on Ubuntu 5.10? I’m just wondering why you use fcgid instead of fastcgi in your Ubuntu set-up tutorial…?

    Posted on 12/08/05 10:45 PM    #

  2. Claudio said:

    mmh… no fcgid is just “another” fastcgi implementation, and yes I’m trying all of these in Ubuntu 5.10.

    I’m just trying various setup. The fcgid lacks documentation, but it is heavily recommended by the RoR folks. Someone told me about a memory leak in the fastcgi setup. Some others told me about some license restrictions in fastcgi (it is in debian nonfree, they told me). fastcgi seems to be more “development” friendly, in that it caches less aggressively. But using f*cgi in development it’s not a great idea, anyway… the latest webrick seems quite speedy.

    Posted on 12/08/05 11:00 PM    #

commenting closed for this article

This site

Browse by category

Contacts

Feed from feedburner Subscribe to this feed with Bloglines

Creative Commons

XFN Friendly