# Apache+fcgi is out, apache+mongrel is in

**URL:** <https://www.ruby-forum.com/t/apache-fcgi-is-out-apache-mongrel-is-in/118381>\
**Category:** Rails\
**Created:** [October 26, 2007, 10:57am UTC](https://www.ruby-forum.com/t/apache-fcgi-is-out-apache-mongrel-is-in/118381 "2007-10-26T10:57:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [October 26, 2007, 10:57am UTC](https://www.ruby-forum.com/t/apache-fcgi-is-out-apache-mongrel-is-in/118381/1 "2007-10-26T10:57:09Z")

</div>

I’m switching from apache fcgi (which actually corrupts my server’s  
memory, which causes some interesting results… none good) to apache

- mongrel\_cluster.

I have this in my apache config file:

\<proxy balancer://guildcorner\>  
BalancerMember [http://127.0.0.1:10000](http://127.0.0.1:10000)  
BalancerMember [http://127.0.0.1:10001](http://127.0.0.1:10001)  
BalancerMember [http://127.0.0.1:10002](http://127.0.0.1:10002)  
  
  
DocumentRoot /www/eq2guild/guildcorner/current/public  
\<directory “/www/eq2guild/guildcorner/current/public”\>  
Options FollowSymLinks  
AllowOverride None  
Order allow,deny  
Allow from all  
  
ProxyPass / balancer://guildcorner/  
ProxyPassReverse / balancer://guildcorner/

Now, [http://blog.flame.org/welcome](http://blog.flame.org/welcome) works and is served by rails.  
However, there are two problems with this that I can see. One, I’d  
like Apache to serve the static content if at all possible. Why  
bother mongrel with that stuff?

And two – [http://blog.flame.org/](http://blog.flame.org/) does not work. At all. It seems  
that it’s being handled by the upper layer in fact – by a completely  
different virtual host (the “default” one.)

The second point is more serious, since I could make this  
configuration go live without the optimization of apache serving the  
static files.

Any suggestions? Google shows me about 100 different ways to do the  
same things, some a few lines shorter, most a lot longer. None work  
as well as what I have now.

–Michael

---

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [October 26, 2007, 11:41am UTC](https://www.ruby-forum.com/t/apache-fcgi-is-out-apache-mongrel-is-in/118381/2 "2007-10-26T11:41:01Z")

</div>

On 26 Oct 2007, at 09:56, Michael G. wrote:

> Now, [http://blog.flame.org/welcome](http://blog.flame.org/welcome) works and is served by rails.  
> However, there are two problems with this that I can see. One, I’d  
> like Apache to serve the static content if at all possible. Why  
> bother mongrel with that stuff?

We do

RewriteEngine On

RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
RewriteRule ^/(.\*)$ balancer://foo\_cluster%{REQUEST\_URI} [P,QSA,L]

The condition is basically 'if the url doesn’t correspond to an  
actual file, then proxy through to foo\_cluster.

> And two – [http://blog.flame.org/](http://blog.flame.org/) does not work. At all. It seems  
> that it’s being handled by the upper layer in fact – by a completely  
> different virtual host (the “default” one.)

I don’t why that’s not working. our configs look like

\<VirtualHost \*:80\>  
ServerName [foo.texperts.com](http://foo.texperts.com)  
…

Fred

---

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [October 26, 2007, 4:22pm UTC](https://www.ruby-forum.com/t/apache-fcgi-is-out-apache-mongrel-is-in/118381/3 "2007-10-26T16:22:37Z")

</div>

I’m doing the same thing as Frederick on the caching issue.

> And two – [http://blog.flame.org/](http://blog.flame.org/) does not work. At all. It seems  
> that it’s being handled by the upper layer in fact – by a completely  
> different virtual host (the “default” one.)

Not sure what the problem is but here is a config from working  
apache2.2 with mongrel and mod\_proxy\_balancer.

\<VirtualHost 192.168.1.87\>  
DocumentRoot /var/www/html/randomutterings/  
ServerName [randomutterings.com](http://randomutterings.com)  
ServerAlias [www.randomutterings.com](http://www.randomutterings.com)  
EnableMMAP off  
EnableSendfile off  
RewriteEngine On  
# Rewrite index to check for static  
RewriteRule ^/$ /index.html [QSA]  
# Rewrite to check for Rails cached page  
RewriteRule ^([^.]+)$ $1.html [QSA]  
# Redirect all non-static requests to cluster  
RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
RewriteRule ^/(.\*)$  
balancer://mongrel\_cluster%{REQUEST\_URI}  
[P,QSA,L]  
SetEnv force-proxy-request-1.0 1  
SetEnv proxy-nokeepalive 1  
\<Proxy balancer://mongrel\_cluster\>  
BalancerMember [http://192.168.1.87:8030](http://192.168.1.87:8030)  
BalancerMember [http://192.168.1.87:8031](http://192.168.1.87:8031)  
BalancerMember [http://192.168.1.87:8032](http://192.168.1.87:8032)  
BalancerMember [http://192.168.1.87:8033](http://192.168.1.87:8033)  
BalancerMember [http://192.168.1.87:8034](http://192.168.1.87:8034)  
BalancerMember [http://192.168.1.87:8035](http://192.168.1.87:8035)

On Oct 26, 5:40 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
