遇到这样一个问题,我在一个windows server上部署了tomcat8(使用默认的8080端口),发布一个webapp1,但是由于业务需要,客户还要求域名后不接端口号(即使用80端口)部署另一个webapp2,那问题就是如何在一台server上部署多个tomcat呢?查了很多网上的资料,归纳出来有2种办法,本文先介绍第一种。
首先来了解一下tomcat在windows上的环境变量配置,具体细节见http://tomcat.apache.org/tomc...,其中提到:
The description below uses the variable name $CATALINA_BASE to refer
the base directory against which most relative paths are resolved. If
you have not configured Tomcat for multiple instances by setting a
CATALINA_BASE directory, then $CATALINA_BASE will be set to the value
of $CATALINA_HOME, the directory into which you have installed
Tomcat.
描述了$CATALINA_BASE和$CATALINA_HOME的区别,前者是tomcat的工作目录(如conf、logs、temp、webapps、work和shared文件),后者是安装目录(如bin),上文提到,如何不需要配置多实例,那么$CATALINA_BASE和$CATALINA_HOME设置成一样的。虽然我们要求也是多实例,但是方便起见,先用最容易的方法。