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

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

问题描述

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



我可以获得它使得

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

工作,但我想要的是

  http://virtualhost1.example.com/ 

直接转到我的应用程序。网站上的很多教程网站只是使您的网络应用程序成为ROOT,但这不会在多个grails-app虚拟主机环境中运行。



我尝试使用

 <主机名=virtualhost1.example.com...> < /主机> tomcat / conf / server.xml文件中的

标签,但似乎没有做任何事情(并且,是的,每当我更改它时,我重新启动了tomcat。)



我也尝试了我在apache配置文件中为虚拟主机想的一切,所以,当我有多个grails webapps,虚拟主机,而且我没有时,如何在URL中摆脱应用程序名称?我想我的webapp是ROOT?

解决方案

我假设你使用 mod_jk 连接Apache& Tomcat的。如果是这样,您将必须在Tomcat中配置虚拟主机以及Apache (多个 < Host> 声明在您的conf / server.xml中)



这基本上意味着你会有两个<$ conf / server.xml中的c $ c>< Host ...> 声明。他们会有不同的名字和appBase,但你仍然必须命名战争ROOT.war



他们给出的例子是:

 < Engine name =CatalinadefaultHost =ren> 
<主机名=renappBase =renapps/>
< Host name =stimpyappBase =stimpyapps/>
< / Engine>

配置虚拟< host> s'(非常像Apache),你必须把你的ROOT.war放到单独的文件夹{renapps,stimpyapps}中,而不是默认的webapps文件夹



这个方法有效,但是另一种方法是使用 mod_proxy 而不是 mod_jk 。我不太熟悉 mod_proxy ,但是基本上你将使连接器句柄将根上下文转换为实际上下文。所以在配置之后它会代理&转发请求发送到 http://virtualhost1.example.com/ 到Tomcat中的正确上下文( /myGrailsApplication-0.1 /



让我们知道你找到什么!其他人都用 mod_proxy


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

The example that they gave was:

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

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

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

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

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

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