I have been playing with RoR & more recently Mongrel & have at last
almost got the set up I consider to be the smartest (I am sort of
emulating mod_jk which is fantastic for using a context in a url to
direct specific urls to any tomcat on any nearby computer). In effect
I can’t & don’t want to use Virtual Hosting plus I am condemmed to used
Win2003 for our corporate servers.
Mongrel has been fantastic for what I am doing. This is what I do to
redirect Apache (2.2.3) traffic coming in on port 80 to my mongrel app
on port 8087 …
- In the \config\routes.rb file I change
(this adds a context into the url but only for the dynamic content.
By this I mean that for all RoR generated urls for dynamic content, RoR
adds ms01/ and in Apache conf
all I add is …
ReWriteRule ^/ms1/(.*) http://localhost:8087/ms1/$1 [P]
(for me ms1 = Mongrel service one)
Now without the uneeded gumph of Virtual hosts I can tell my Apache to
to any Mongrel server I want, on any port, and or any other server & we
do plan to have different apps on different servers as well as some on
the same server as Apache.
BUT, in RoR the static urls don’t get the ms1/ added - RoR when looking
Apache server’s default homedir I there is no rewrite rule I can think
of that can identify the static url of one particular app vs any other
The problem I have is that doing what I am doing means that all static
placed on the one server in one folder while I can put the dynamic
Ideally RoR would give me an option to add the ms1\ string onto the
front of my static content urls just as it now adds ms1\ onto the front
of my dynamic urls. If I could add a context string (even better if for
example I could make it different to the dynamic content url (i.e. for
dynamic add ms1d\ and on the static content add ms1s\ then I could
direct Apache to where ever I like for either type of content - even
both contexts to the same server if I wanted - all the control is in
the Apache conf file.
If anyone can suggest a way or a ReWriteRule or a Condition that would
allow me to identify incoming urls to Apache, both static content and
dynamic content, and to identify which these urls belong to, I
will have a very flexible way of implementing multiple apps on multiple
servers. With Java/Apache & Tomcat, I have this today with mod_jk. I
feel I am so close to getting this same flexibility in RoR.
(IT Tech Architect & one big Rails & Mongrel fan)