多个域到tomcat中的单个webapp [英] multiple domains to single webapp in tomcat
本文介绍了多个域到tomcat中的单个webapp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在tomcat 7中将多个子域指向单个webapp?
Is there any way to point multiple sub domains to single webapp in tomcat 7 ?
例如
admin.test.com
已分配给webapp。我想分配
has already assigned to a webapp. I want to assign
operator.test.com
也适用于该应用。 (类似于两个网址都指向相同的webapp。)
also to that app. (something like both urls point to same webapp.)
推荐答案
在我的头脑中,我可以考虑以下方法。
On the top of my head I can think about the following ways.
- 创建war文件的副本,给它不同的方式并放在
TOMCAT_HOME / webapps $ c $下C>。实际上这意味着您将从相同的代码库安装2个应用程序。但是,如果您的应用程序仅使用DB来存储状态,则这可能不是问题。
- 如果您在Unix上,请在webapps目录中创建指向war文件的软链接。因此,您将获得与#1相同的解决方案,但不会复制文件。
- 创建指向同一文件的2个上下文。有关详细信息,请参阅此文档或类似文档: http://tomcat.apache .org / tomcat-5.5-doc / config / context.html #Automation_Context_Configuration
- 使用别名。以下文档解释了如何: http://tomcat.apache。 org / tomcat-5.5-doc / config / host.html#Host_Name_Aliases
- Create copy of your war file, give it different way and put under
TOMCAT_HOME/webapps
. Actually this means that you will have 2 applications installed from the same code base. However if your application uses only DB to store state this is probably not a problem. - If you are on Unix create softlink into webapps directory to your war file. So, you will get the same solution as in #1 but without copying file.
- Create 2 contexts that point to the same file. For details see this or similar document: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html#Automatic_Context_Configuration
- Use alias. Here is document that explains how: http://tomcat.apache.org/tomcat-5.5-doc/config/host.html#Host_Name_Aliases
这篇关于多个域到tomcat中的单个webapp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文