Has anyone configured multiple Rails apps within the same VirtualHost directive? I need to do this with the apps selected by the initial path. I''m using Apache 2.2.3 with mod_proxy_balancer and Rails 2.0.2. In fact, non-Rails apps have to be configured within this VirtualHost also, but that problem has been solved via a Location directive. I tried a similar Location statement for the Rails apps with no success yet, so I thought I''d see if anyone has already done this. To date, I''ve only needed to configure one Rails app within a VirtualHost with what appears to be a fairly typical config. Any info sources for more advanced Apache configuration for Rails would be appreciated. Brian Adkins --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Brian, I would look at using mod_proxy to send different URLs to your rails apps if you need to do in one virtual host. You would start each app with mongrel_rails on X port and then config Apache like so: #mongrel rails app#1 running on 3000 ProxyPass /yourapp_prefix http://<yourserver>:3000 ProxyPassReverse /yourapp_prefix http://<yourserver>:3000 #mongrel rails app#1 running on 3001 ProxyPass /yourapp2_prefix http://<yourserver>:3001 ProxyPassReverse /yourapp2_prefix http://<yourserver>:3001 The real issue you will run into with a VPS is memory usage. Some VPSs will kill your mongrel''s if they hog resources. So you''ll want to also run a cron script or "monit" to keep an eye on them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 18, 11:52 am, blasterpal <hbea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Brian, > > I would look at using mod_proxy to send different URLs to your rails > apps if you need to do in one virtual host. You would start each app > with mongrel_rails on X port and then config Apache like so: > > #mongrel rails app#1 running on 3000 > ProxyPass /yourapp_prefix http://<yourserver>:3000 > ProxyPassReverse /yourapp_prefix http://<yourserver>:3000I''ve seen some folks using the above (ProxyPass ProxyPassReverse), and others using the following (RewriteRule). Any advantages of one over the other? # Redirect all non-static requests to cluster RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/app1(.*)$ balancer://cluster1%{REQUEST_URI} [P,QSA,L] RewriteRule ^/app2(.*)$ balancer://cluster2%{REQUEST_URI} [P,QSA,L]> #mongrel rails app#1 running on 3001 > ProxyPass /yourapp2_prefix http://<yourserver>:3001 > ProxyPassReverse /yourapp2_prefix http://<yourserver>:3001 > > The real issue you will run into with a VPS is memory usage. Some VPSs > will kill your mongrel''s if they hog resources. So you''ll want to also > run a cron script or "monit" to keep an eye on them.This is on a dedicated machine, not a VPS. The reason I need multiple Rails apps configured in the same VirtualHost is because we''re already using the host name for another purpose - to identify an organization. We''ve specified a * wildcard DNS entry to allow handling any number of hosts (the apps will parse the hostname to determine organization). For example: http://<orgname>.foo.com/rails1/controller/action/... http://<orgname>.foo.com/rails2/controller/action/... http://<orgname>.foo.com/nonrails1/... http://<orgname>.foo.com/nonrails2/... The apps are written by one company and cooperate, but also have a degree of independence. I''d prefer to have each app provide its own location for static files for Apache to serve directly, so I think my main problem is finding a nice way to have the equivalent of a docroot per app. I could probably live with a solution that requires the rails app to share a directory tree - maybe via soft links. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 18, 11:24 am, Brian Adkins <lojicdot...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Has anyone configured multiple Rails apps within the same VirtualHost > directive? I need to do this with the apps selected by the initial > path. I''m using Apache 2.2.3 with mod_proxy_balancer and Rails 2.0.2.The following solution seems to work fairly well for me so far: http://tonyrose023.blogspot.com/2007/01/multiple-rails-apps-with-mongrel.html I had to mess around with some additional RewriteRules to get Apache to serve static files instead of mongrel and to deal with Rails caching. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---