# Fastcgi on apache

**URL:** <https://www.ruby-forum.com/t/fastcgi-on-apache/51713>\
**Category:** Rails\
**Created:** [January 6, 2006, 6:07am UTC](https://www.ruby-forum.com/t/fastcgi-on-apache/51713 "2006-01-06T06:07:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [January 6, 2006, 6:07am UTC](https://www.ruby-forum.com/t/fastcgi-on-apache/51713/1 "2006-01-06T06:07:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [January 6, 2006, 10:31am UTC](https://www.ruby-forum.com/t/fastcgi-on-apache/51713/2 "2006-01-06T10:31:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [January 6, 2006, 10:43am UTC](https://www.ruby-forum.com/t/fastcgi-on-apache/51713/3 "2006-01-06T10:43:58Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [January 6, 2006, 11:14am UTC](https://www.ruby-forum.com/t/fastcgi-on-apache/51713/4 "2006-01-06T11:14:10Z")

</div>

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 😉
