Tags:

data mining   fail save   gentoo   html2pdf   lazykid   mod_fcgid   nothing to hide   onetime password   open office   otp   privacy   ruby   ruby on rails   security   test driven development  

Last update
(Nov 25 2007)

Gentoo, Rails and mod_fcgid

Monday 19 November 2007 - 04:17 by sven

My friend Marcel asked me about my Gentoo, Rails and mod_fcgid configuration.

Here it is:

Software versions:

Content of the .htaccess file inside the public directory of the rails application:

Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteBase /
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"

Example vhost entry:

<VirtualHost *:80>
    ServerAdmin webmaster@domain.tld
    DocumentRoot "/var/www/www.domain.tld/public/"
    ErrorLog /var/www/www.domain.tld/log/apache.log
    ServerName domain.tld
    Serveralias domain.tld
    <Directory "/var/www/www.domain.tld/public">
      Options ExecCGI FollowSymLinks
      AddHandler fcgid-script .cgi .fcgi .fcg
      AllowOverride all
      Order allow,deny
      Allow from all
    </Directory>
</VirtualHost>   

Last things to do: 

Make sure that the rails tmp directory is writeable by the webserver.

Do not forget to run apache with mod_fcgid enabled. Edit /etc/conf.d/apache and add ' -D FCGID ' to the APACHE2_OPTS. Then restart the webserver with /etc/init.d/apache2 restart .

I removed dispatch.cgi to be sure that dispatch.fcgi is used.


mod_fcgid ruby on rails gentoo

Make a Comment!