Dear Mongrel users, I would like to use Mongrel to introduce RoR on an existing Apache/PHP server. The server serves several domains, set up as virtual hosts. The idea is to install a Rails application to be used in addition to the existing configuration. Example: www.domain1.com/index.php -> Via Apache www.domain1.com/appname/controller/action -> RoR application I am at a loss how to do this, so help is appreciated! Thanks, Mike PS: One of the servers on which I want to do this is running Apache 1.3, the other Apache 2.2. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Mike, Should be possible, the trick will be to configure your routes.rb so that all Rails actions are prefixed with /appname and then setup mod_proxy and (possibly) mod_rewrite to send back to Mongrel. This will help with some typical issues: http://wiki.rubyonrails.org/rails/pages/HowtoDeployMoreThanOneRailsAppOnOneM achine Then you''ll basically just have to prefix your routes appropriately and get the mod_proxy config working right. Zed\ On 3/16/06 12:21 PM, "Mike M" <spmikedev at yahoo.com> wrote:> Dear Mongrel users, > > I would like to use Mongrel to introduce RoR on an existing Apache/PHP server. > The server serves > several domains, set up as virtual hosts. > The idea is to install a Rails application to be used in addition to the > existing configuration. > Example: > www.domain1.com/index.php -> Via Apache > www.domain1.com/appname/controller/action -> RoR application > > I am at a loss how to do this, so help is appreciated! > > Thanks, > Mike > > PS: One of the servers on which I want to do this is running Apache 1.3, the > other Apache 2.2. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users
Question: Is it possible to run several applications using a single mongrel instance? Background: I want to set up several low-traffic sites on one server. I now have this configuration: 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 applications. Thanks, Mike __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Hi Mike, Answers below... 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 > instance? >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.> Background: > I want to set up several low-traffic sites on one server. I now have this > configuration: > > 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 > applications. >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. Zed
Hi Zed, Thanks for your answers. Actually, in my example, I meant having e.g. 10 virtual domains (=10 applications) that are handled by a pool of say 4 mongrels. But from your first answer I understand that this is not a wise choice. I need a minimum of 1 mongrel per application. Thanks, Mike --- Zed Shaw <zedshaw at zedshaw.com> wrote:> Hi Mike, > > Answers below... > > > 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 > > instance? > > > 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. > > > Background: > > I want to set up several low-traffic sites on one server. I now have this > > configuration: > > > > 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 > > applications. > > > > 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. > > Zed > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com