apache+fcgi is out, apache+mongrel is in

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   BalancerMember http://127.0.0.1:10001   BalancerMember http://127.0.0.1:10002 </proxy> <VirtualHost blog.flame.org:80>   DocumentRoot /www/eq2guild/guildcorner/current/public   <directory "/www/eq2guild/guildcorner/current/public">     Options FollowSymLinks     AllowOverride None     Order allow,deny     Allow from all   </directory>   ProxyPass / balancer://guildcorner/   ProxyPassReverse / balancer://guildcorner/ </VirtualHost>

Now, 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/ 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

Now, 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/ 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    ...

Fred

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

And two -- 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         ServerAlias 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                 BalancerMember http://192.168.1.87:8031                 BalancerMember http://192.168.1.87:8032                 BalancerMember http://192.168.1.87:8033                 BalancerMember http://192.168.1.87:8034                 BalancerMember http://192.168.1.87:8035         </Proxy> </VirtualHost>