# Mongrel cluster w/ apache

**URL:** <https://www.ruby-forum.com/t/mongrel-cluster-w-apache/105851>\
**Category:** Rails\
**Created:** [June 3, 2007, 8:23pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-w-apache/105851 "2007-06-03T20:23:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [June 3, 2007, 8:23pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-w-apache/105851/1 "2007-06-03T20:23:43Z")

</div>

hi all,

i’m working on deploying my app w/ apache and a mongrel cluster. i’ve  
started by copying the instructions and code from the agile rails book  
and everything seems to be working fine but apache isn’t forwarding my  
requests to mongrel the way i expect it should. there’s nothing in the  
rewrite logs and nothing but 404 errors in the apache error logs.

[http://127.0.0.1:8000/railsaction/railsmethod](http://127.0.0.1:8000/railsaction/railsmethod)

…loads up my app in mongrel so all is fine there. i’m thinking  
apache should have no problem when i browse to:

[http://elsewhere.thealarmlights.net:555/railsaction/railsmethod](http://elsewhere.thealarmlights.net:555/railsaction/railsmethod)

i get 404 errors…

is there some special incantation necessary to make this work?

the relevant parts of my apache config follow:

\<Proxy balancer://mongrel\_cluster\>  
BalancerMember [http://127.0.0.1:8000](http://127.0.0.1:8000)  
BalancerMember [http://127.0.0.1:8001](http://127.0.0.1:8001)  
  
\<VirtualHost \*:555\>  
ServerName [thealarmlights.net](http://thealarmlights.net)  
DocumentRoot /usr/local/www/weposs/current/public  
\<Directory “/usr/local/www/weposs/current/public” \>  
Options FollowSymLinks  
AllowOverride None  
Order allow,deny  
Allow from all  
  
RewriteEngine On  
RewriteLog logs/weposs\_rewrite\_log  
RewriteLogLevel 9

# Check for maintenance file and redirect all requests

RewriteCond %{DOCUMENT\_ROOT}/system/maintenance.html -f  
RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
RewriteRule ^.\*$ /system/maintenance.html [L]

# 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]

if anyone can help me sort this i’d appreciate it so much. i worked so  
hard to get this far (and learned a lot) but i’m stuck pretty bad at  
this point.

thanks.

-mike bannister

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [June 3, 2007, 9:55pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-w-apache/105851/2 "2007-06-03T21:55:59Z")

</div>

Hey Mike,

Not real sure to be honest but I’d try dropping a:

ServerAlias [elsewhere.thealarmlights.net](http://elsewhere.thealarmlights.net)

in that vhost section. Unless it’s the first vhost configured I don’t  
think it will find it without that.

good luck  
Tim

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [June 3, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-w-apache/105851/3 "2007-06-03T22:43:07Z")

</div>

1. You need to add:

2. Make sure your proxy is allowed from Apache configuration file.  
You should have:

Notice there’s “Allow from all” - that’s turning it on. However,  
since you’re getting 404 error and not 500. That appears to be okay,  
but check it anyway.

Hope this helps.

Joon

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [June 4, 2007, 1:42am UTC](https://www.ruby-forum.com/t/mongrel-cluster-w-apache/105851/4 "2007-06-04T01:42:18Z")

</div>

As Tim said, you probably need the ServerAlias directive. You didn’t  
show it, so I wonder if you have the “NameVirtualHost \*:555” specified  
anywhere. I believe you may need that in your case. I did for my setup,  
which is very similar to yours. In fact, everything else about your  
configuration is identical to my own, and it’s working for me (although  
I use port 80 and I just use “[www.domain.com](http://www.domain.com)”, without ServerAlias).

n
