Ruby on Rails under Apache/FastCGI problems


#1

Hi!

I’m trying to get Rails work with Apache/FastCGI, but it seems to error
on something I can’t trace. I have the Oracle database driver (OCI8)
installed, but I currently don’t use it (the database.yml is configured
to use MySQL). For some reason, I had to add the Oracle environment
variables to get the Rails FastCGI server to boot. Everything works fine
when I use Webrick (i.e. ./script/server).

Any help is appreciated!

TIA,

  • Matthias

The error I get in my Apache error_log:

[Mon Dec 12 15:44:18 2005] [notice] Apache/2.0.52 (CentOS) configured –
resuming normal operations
[Mon Dec 12 15:44:18 2005] [warn] FastCGI: server
“/srv/www/public/dispatch.fcgi” started (pid 16778)
[Mon Dec 12 15:44:26 2005] [error] [client 127.0.0.1] FastCGI:
incomplete headers (35 bytes) received from server
“/srv/www/public/dispatch.fcgi”

The related part of the Apache configuration:

LoadModule fastcgi_module modules/mod_fastcgi.so

FastCgiIpcDir /tmp/fcgi_ipc FastCgiServer /srv/www/public/dispatch.fcgi \ -initial-env RAILS_ENV=development \ -initial-env LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.1/client/lib \ -initial-env ORACLE_HOME=/usr/lib/oracle/10.2.0.1/client \ -processes 2 \ -idle-timeout 60

<Directory /srv/www/public>
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

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

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


#2

I was fighting this problem for a few days. I don’t really know what
solved
it but I did the following:

Reinstalled the FCGI gem.
Rebuilt .htaccess, dispatch.fcgi and dispatch.rb

It’s working now but who knows.


#3

That didn’t fix the problem. I think I’ll use lighttpd instead (that
works fine now).

Thanks anyway!

  • Matthias

Hunter’s Lists wrote:

I was fighting this problem for a few days. I don’t really know what
solved
it but I did the following:

Reinstalled the FCGI gem.
Rebuilt .htaccess, dispatch.fcgi and dispatch.rb

It’s working now but who knows.