[Mongrel] Several applications on one box
zedshaw at zedshaw.com
Mon Apr 17 16:20:29 EDT 2006
On 4/9/06 7:27 AM, "Mike M" <spmikedev at yahoo.com> wrote:
> Question: Is it possible to run several applications using a single mongrel
Probably not the very best idea really. I believe there's some hacks out
there that will make Rails do this, but I've found that mixing Rails with
anything--even other rails apps--in the same Ruby process is pure death.
My thinking is that if you really wanted to support it then you'd have to
somehow have a small Mongrel handler that caught the Host: header and routed
to different URLs based on that. If you're going to do this then I'd
recommend using mod_rewrite in Apache or Lighttpd.
> I want to set up several low-traffic sites on one server. I now have this
> Apache virtual-host for domain1
> -> proxy to mongrel instance 1 on port 3000
> Apache virtual-host for domain2
> -> proxy to mongrel instance 2 on port 3001
> etc etc.
> Ideally, I'd like a pool of say 4 mongrel instances to serve all the
Now, this will work. I know of several people who do this with Apache and
Lighttpd. Main thing is to put the Proxy configurations inside the Vhost
configs so that when people request domain1 they are proxied back to port
3000, and so on. If your sites are really low traffic then one Mongrel for
each site should be good enough.
If you want to have many Mongrel servers as backends easily via Apache I
recommend you use http://www.inlab.de/balance.html and have it listen on
port 3000 and then proxy to as many as you want. In your case you'd run two
balance servers: one for port 3001 and another for port 3000.
Hope that helps.
More information about the Mongrel-users