2

我在本地主机上运行 Tomcat 7(通过 mod_proxy_ajp 连接器连接到 apache 2.2 httpd)。我的webapps文件夹在tomcat中设置conf/server.xml/Users/myname/Sites/webapps.

是否有可能以某种方式进行配置,以便我可以在不在文件夹内的webapps文件夹中拥有其他 Tomcat 应用程序?如果是这样,怎么做?

例如,是否允许Host在 -- 中添加额外的条目server.xml,当然,例如:

 <Host name="myapp.local" appBase="/Users/myname/Sites/myapp"
 ....
 />

然后,如果允许,我是否只需将默认Host条目中的常用内容复制到此类附加条目中?

4

1 回答 1

2

Does docBase attribute of the Context element solve your problem?

<Context docBase="/path/to/your/another/webapp" ...

You can get more details about docBase attribute here:

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Common_Attributes

Suppose your webapp is located in /path/to/myapp. You can deploy your webapp by creating a following xml file.

$CATALINA_BASE/conf/[enginename]/[hostname]/myapp.xml:

<Context docBase="/path/to/myapp">
</Context>

Hope this helps.

于 2013-04-29T15:31:44.450 回答