Problem with Apache 2 and mod_fcgid


I have a problem with Apache 2 and mod_fcgid.

In fact, it seems there are correctly installed and configured: my
rails application works (see ) ... but the
stylesheets aren't loaded.

The generated url ( <%= stylesheet_link_tag "styles", :media => "all"
%> ) looks correct.

But when I try to access the stylesheet (see ), I have a HTTP 500 error
(internal server error).

** Apache 2 ( under FreeBSD 6) configuration:

LoadModule fcgid_module libexec/apache2/
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
SocketPath /tmp/fcgi_ipc
DefaultInitEnv RAILS_ENV production
IdleTimeout 600
ProcessLifeTime 3600
MaxProcessCount 8
IPCConnectTimeout 60
IPCCommTimeout 60

** Virtual host configuration :

<VirtualHost *:80>
        DocumentRoot /var/www/cedric/
        CustomLog /var/log/bepolytech/cedrich combined
        ErrorLog /var/log/bepolytech/cedrich.error

        <Location />
        AddHandler fcgid-script .fcgi

        RewriteEngine On
        RewriteRule ^$ index.html [QSA]
        RewriteRule ^([^.]+)$ $1.html [QSA]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

        ErrorDocument 500 /500.html
        ErrorDocument 404 /404.html

        <Directory "/var/www/cedric/">
        SetHandler fcgid-script
        Options Indexes +FollowSymlinks +ExecCGI
        AllowOverride all
        Order allow,deny
        Allow from all


** And my public/.htaccess (uncommented lines):

AddHandler fcgid-script .fcgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

Could you help me ?

Thanks !

I think all non-rails URL's ( like ) are wrong ( HTTP 500 error).

It's weird :s

hi cedric

in .htaccess u have to put RewriteRule ^(.)$ dispatch.fcgi [QSA,L] not RewriteRule ^(.)$ dispatch.cgi [QSA,L]

also this is weird u should check again if files are uploaded

also why did u copy and paste .htaccess rules in the apache config, u should put it in only one place


My .htaccess is now correct and I removed the rules from apache config.
And the files are uploaded...

I don't understand how to successfully configure apache and fcgid ...
grrrrr ....

I would *highly* recommend using mongrel instead.

Yes but the server where I host my ror application hosts some other
websites ( php, etc) ... I could try with an apache proxi server, and
mongrel but it's more complicated.

Correction: it's not as complicated as I though:

:smiley: <-- The PHP kind of like mongrel sort of thingy you could probably use.

It's actually pretty fast, and it'd make your php apps get inline with the theme of "just use http". But, I haven't actually used it.