I haven't been able to figure out how to deploy multiple grails applications with Apache/Tomcat where a virtual host is mapped to each grails app
I can get it so that
http://virtualhost1.example.com/myGrailsApplication-0.1/
works, but what I want is for
http://virtualhost1.example.com/
to go directly to my application. A lot of tutorial sites on the web just have you make your web app the "ROOT" one, but that won't work in a mutiple grails-app virtual host environment.
I tried using the
<Host name="virtualhost1.example.com" ...> </Host>
tags in the tomcat/conf/server.xml file, but it didn't seem to do anything (and, yes, I restarted tomcat each time I changed it.)
I also tried everything I could think of in my apache config file for the virtual host, and couldn't get it to work.
So, how can I get rid of the app name in the URL when I have multiple grails webapps, virtual hosts, and I don't want my webapp to be "ROOT"?
I'm assuming that you are using
mod_jk
to connect Apache & Tomcat. If so, You will have to have to configure virtual hosting within Tomcat as well as Apache (multiple<Host>
declarations in your conf/server.xml)This basically means that you'll have two
<Host ...>
declarations within conf/server.xml. They will have different names, and appBase, but you will still have to name the war ROOT.warThe example that they gave was:
After you've configured the DNS of your virtual '
<host>
s'(much like Apache) you'll have to put your ROOT.war(s) into separate folders {renapps,stimpyapps} instead of the default 'webapps' folderThis method works, but there is another method using
mod_proxy
instead ofmod_jk
. I'm not that familiar withmod_proxy
but basically you would have the connector handle translating the root context to the actual context. So after its configured it would proxy & forward requests sent tohttp://virtualhost1.example.com/
to the right context within Tomcat (/myGrailsApplication-0.1/
)Let us know what you find! Anyone else do this with
mod_proxy
?