部署与Apache / Tomcat的+虚拟主机多个Grails应用程序 [英] Deploying multiple grails applications with Apache/Tomcat + Virtual Hosts

查看:158
本文介绍了部署与Apache / Tomcat的+虚拟主机多个Grails应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直无法弄清楚如何部署,其中虚拟主机映射到每个Grails的应用程序与Apache / Tomcat的多个Grails应用程序

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

我能得到它,这样

http://virtualhost1.example.com/myGrailsApplication-0.1/

的作品,但我要的是

works, but what I want is for

http://virtualhost1.example.com/

直接进入我的申请。很多在网络上的教程网站只是还你让你的Web App中的ROOT之一,但不会在多发的Grails应用虚拟主机环境中工作。

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.

我尝试使用

<Host name="virtualhost1.example.com" ...> </Host>

在tomcat / conf / server.xml文件标签,但它似乎没有做任何事情(是的,我每一次我改变了它重新启动Tomcat的。)

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.)

我也尝试了所有我能想到的在虚拟主机我的Apache的配置文件,并不能得到它的工作。

I also tried everything I could think of in my apache config file for the virtual host, and couldn't get it to work.

所以,我怎样才能在URL中摆脱了应用程序的名字时,我有多个Grails的web应用,虚拟主机,我不希望我的web应用程序是ROOT?

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"?

推荐答案

我假设你正在使用的mod_jk 连接的Apache和放大器; Tomcat中。如果是这样,您必须有在Tomcat配置虚拟主机作为还有的Apache (多 &LT;主机&GT; 声明,在你的conf / server.xml中的)

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)

这基本上意味着你将有两个&LT;主机...&GT; 的conf / server.xml中内声明。他们将有不同的名称,和的appBase,但你还是要名义进行的战争ROOT.war

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.war

这是他们给了这个例子:

The example that they gave was:

<Engine name="Catalina" defaultHost="ren">
    <Host name="ren"    appBase="renapps"/>
    <Host name="stimpy" appBase="stimpyapps"/>
</Engine>

在你配置的虚拟域名&LT;主机&GT; S'(就像Apache的),你必须把你的ROOT.war(S )成单独的文件夹{renapps,stimpyapps},而不是默认的webapps文件夹

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' folder

这个方法有效,但使用的mod_proxy 而不是的mod_jk 的另一种方法。我没那么熟悉的的mod_proxy 但基本上你将有连接器手柄转换根上下文的实际环境。所以它的配置后,它会代理和放大器;在Tomcat中( /myGrailsApplication-0.1 / http://virtualhost1.example.com/ 来正确的上下文中转发请求C>)

This method works, but there is another method using mod_proxy instead of mod_jk. I'm not that familiar with mod_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 to http://virtualhost1.example.com/ to the right context within Tomcat (/myGrailsApplication-0.1/)

让我们知道你发现了什么!任何人都做到这一点与的mod_proxy

Let us know what you find! Anyone else do this with mod_proxy?

这篇关于部署与Apache / Tomcat的+虚拟主机多个Grails应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆