【发布时间】:2011-08-10 17:38:04
【问题描述】:
我已经阅读了有关 StackOverflow 的几个问题并在 Google 上搜索了几个小时,但对于在一个 tomcat 5.5(使用 Apache)上部署多个 Grails 应用程序的问题,我找不到完整而明确的答案。也许有人可以将我推向正确的方向,或者我们可以在这里总结一个解决方案。
Deploying multiple grails applications with Apache/Tomcat + Virtual Hosts 的问题看起来很有希望,但没有奏效。也许我需要在 Tomcat 或 Apache 中进行额外的更改?
情况:
在 Tomcat 的 webapps 目录 中,我有两个 war 文件 app1.war 和 app2.war 正在被 Tomcat 解包,我可以通过 domain1.com/app1 或 domain1.com 访问它们/app2(我删除了一个以前使用的 ROOT.war 和关联的 webapps/ROOT/ 目录)
在 Tomcat 的 server.xml 中,我有以下主机:
<!-- Logger shared by all Contexts related to this virtual host. -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_" suffix=".log"
timestamp="true"/>
<!-- Allow symlinks for the tomcat-docs webapp. This is required in
the Debian packages to make the Servlet/JSP API docs work. -->
<Context path="/tomcat-docs" docBase="tomcat-docs" debug="0">
<Resources className="org.apache.naming.resources.FileDirContext"
allowLinking="true" />
</Context>
</Host>
<Host name="domain1.com" appBase="webapps/app1" unpackWARs="true" autoDeploy="true"></Host>
<Host name="domain2.com" appBase="webapps/app2" unpackWARs="true" autoDeploy="true"></Host>
在 Apache 我有以下虚拟主机: 服务器名称 app1.com
JkMount /* default
DocumentRoot /var/lib/tomcat5.5/webapps/app1
<directory /var/lib/tomcat5.5/webapps/app1>
Options -Indexes
</directory>
LogLevel warn
ErrorLog /var/www/app1/logs/error.log
CustomLog /var/www/app1/logs/access.log common
问题:
我无法通过 domain1.com 和 domain2.com 直接访问这两个应用程序 - 我做错了什么?
非常感谢,
乔尔格。
【问题讨论】:
-
只是为了澄清:您想在一个 tomcat 中托管多个应用程序,并且每个应用程序都应该充当单独域的根应用程序?
-
是的 - domain1.com 上的 app1 和 domain2.com 上的 app2 都是运行在 tomcat 上的 Grails 应用程序。
-
我自己从来没有设法解决这个问题 - 所以希望我们能在这里得到答案。
标签: apache tomcat deployment grails