Problem with Apache 2 and mod_fcgid

Hi,

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 http://www.cedrich.be/index ) ... 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
http://www.cedrich.be/stylesheets/styles.css ), I have a HTTP 500 error
(internal server error).

** Apache 2 ( under FreeBSD 6) configuration:

LoadModule fcgid_module libexec/apache2/mod_fcgid.so
<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
</IfModule>

** Virtual host configuration :

<VirtualHost *:80>
        DocumentRoot /var/www/cedric/www.cedrich.net/public/
        ServerName www.cedrich.be
        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]
</Location>

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

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

</VirtualHost>

** 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
http://www.cedrich.be/images/rails.png ) 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

Hi

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.

http://mongrel.rubyforge.org/

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:

http://mongrel.rubyforge.org/docs/apache.html

:smiley:

http://nanoweb.si.kz/ <-- 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.