Can't get Fast CGI working

Well, after many hours of tinkering and internet browsing I just can’t
get Fast CGI to work with Rails and Apache 1.3 on FreeBSD 5.4 Normal CGI
works fine, but as soon as I enable FastCGI in .htaccess I get the
message:

Application error
Rails application failed to start properly

Here’s what I’ve done so far:

  • I’ve installed all the necessary software for rails and fast cgi.

  • FastCGI does seem to be configured correctly in the apache config
    file. I’ve added the necessary virtual host settings and other apache
    directives, as per the instructions on the Rails wiki.

  • In .htaccess I changed

RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

to

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

  • Cleared out rails related temporary files from /tmp.

  • I’ve restarted apache.

  • I’ve restarted my browser.

  • I’ve made sure dispatch.fcgi contains the line “require
    ‘fcgi_handler’” (without quotes, of course).

  • I set the /log directory permissions to 755. Heck, I even set the
    entire rails directory to 777 (it’s on a local intranet, so security
    isn’t a big issue right now).

But despite my best efforts I’m not getting any love from rails and fast
cgi, and I’m completely stuck. Any help would be GREATLY appreciated.

I experienced the (approximately, I’m using Apache 2.x) same problems.
To keep a long story short, I’m using Lighttpd now. The long story is
here: http://www.mindshards.net/?p=15 amongst others. In the end Apache
did work but still unsatisfactory. Rails developers should really
start supporting Apache for real.
From a glace at your post I’d same you need to point to your fcgi
server.

MenDAKE wrote:

Well, after many hours of tinkering and internet browsing I just can’t
get Fast CGI to work with Rails and Apache 1.3 on FreeBSD 5.4 Normal CGI
works fine, but as soon as I enable FastCGI in .htaccess I get the
message:

Application error
Rails application failed to start properly

Here’s what I’ve done so far:

  • I’ve installed all the necessary software for rails and fast cgi.

  • FastCGI does seem to be configured correctly in the apache config
    file. I’ve added the necessary virtual host settings and other apache
    directives, as per the instructions on the Rails wiki.

  • In .htaccess I changed

RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

to

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

  • Cleared out rails related temporary files from /tmp.

  • I’ve restarted apache.

  • I’ve restarted my browser.

  • I’ve made sure dispatch.fcgi contains the line “require
    ‘fcgi_handler’” (without quotes, of course).

  • I set the /log directory permissions to 755. Heck, I even set the
    entire rails directory to 777 (it’s on a local intranet, so security
    isn’t a big issue right now).

But despite my best efforts I’m not getting any love from rails and fast
cgi, and I’m completely stuck. Any help would be GREATLY appreciated.

Thanks for the response, Anon. What do you mean about needing to point
to my fcgi server?

Am Samstag, den 04.03.2006, 20:21 +0100 schrieb MenDAKE:

But despite my best efforts I’m not getting any love from rails and fast
cgi, and I’m completely stuck. Any help would be GREATLY appreciated.

Call

ruby public/dispatch.fcgi

from your Rails root directory and see if some exceptions appear.

Norman T.

http://blog.inlet-media.de

Well I run apache2 and have this file
/etc/apache2/mod-available/fastcgi.conf which is something like a
httpd.conf exerpt. In there I have:
AddHandler fastcgi-script .fcgi
FastCgiIpcDir /var/lib/apache2/fastcgi
FastCgiServer /path/to/your/apps/public/dispatch.fcgi -processes 2
-idle-timeout 60

Which points to your fastcgi server.

MenDAKE wrote:

Thanks for the response, Anon. What do you mean about needing to point
to my fcgi server?

anon wrote:

Well I run apache2 and have this file
/etc/apache2/mod-available/fastcgi.conf which is something like a
httpd.conf exerpt. In there I have:
AddHandler fastcgi-script .fcgi
FastCgiIpcDir /var/lib/apache2/fastcgi
FastCgiServer /path/to/your/apps/public/dispatch.fcgi -processes 2
-idle-timeout 60

Which points to your fastcgi server.

MenDAKE wrote:

Thanks for the response, Anon. What do you mean about needing to point
to my fcgi server?

That was it! I never read anywhere that the above lines need to be added
to the apache file, but that completely fixed my problem. Rails is now
blazingly fast. Thank you VERY much for your help.