Fastcgi on apache


#1

Running on Fedora Core

I have been playing with some of the tutorials and one of them had me
install lighttpd and lighttpd-fastcgi and that was much faster than
apache seems to be.

How do I get fastcgi stuff to work on apache…

I have this setup for my tutorial environment in httpd.conf

<VirtualHost *>
DocumentRoot /home/craig/cookbook/public
ServerName cookbook
<Directory “/home/craig/cookbook/public”>
Options ExecCGI FollowSymLinks
AllowOverride all
allow from all

and it’s considerably slower than the lighttpd server.

Thanks

Craig


#2

Am Donnerstag, den 05.01.2006, 22:06 -0700 schrieb Craig W.:

<VirtualHost *>
DocumentRoot /home/craig/cookbook/public
ServerName cookbook
<Directory “/home/craig/cookbook/public”>
Options ExecCGI FollowSymLinks
AllowOverride all
allow from all

and it’s considerably slower than the lighttpd server.

It seems to me, that you are not starting any FCGI processes. I am
missing a line like this in your apache configuration:

FastCgiServer /var/www/myrailsapp/public/dispatch.fcgi -initial-env
RAILS_ENV=production -processes 3 -idle-timeout 60


#3

Norman T. wrote:

I have this setup for my tutorial environment in httpd.conf

and it’s considerably slower than the lighttpd server.

It seems to me, that you are not starting any FCGI processes. I am
missing a line like this in your apache configuration:

FastCgiServer /var/www/myrailsapp/public/dispatch.fcgi -initial-env
RAILS_ENV=production -processes 3 -idle-timeout 60

In my Apache configuration these line is in directive:
AddHandler fastcgi-script .fcgi

And .htaccess from rails public directory is updated to use FCGI
dispatcher instead of CGI one:
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]


#4

Am Freitag, den 06.01.2006, 10:40 +0100 schrieb Bojan M.:

In my Apache configuration these line is in directive:
AddHandler fastcgi-script .fcgi

And .htaccess from rails public directory is updated to use FCGI
dispatcher instead of CGI one:
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Ok, i checked this: If you have no FastCgiServer directive, Apache
starts up a new FCGI processes every time all other FCGI processes are
busy. The first time you send a request to your application, the first
process is spawned. If my understanding is right, this could end in
uncountable FCGI processes if your server is under heavy load. So it is
better to control the process spawning with the FastCGIServer directive.

But this was not your question: If you set the your RewriteRule to
dispatch.fcgi you should run under FCGI. You can check if some processes
like

/usr/local/bin/ruby /var/www/myrailsapp/public/dispatch.fcgi

exist after requesting your application.

Maybe LightHttpd is faster, at all :wink: