1第一步:修改 $TOMCAT_HOME\conf\server.xml文件。
復(fù)制Service節(jié)點(diǎn)争涌,去掉<Connector port="8009"...這個(gè)節(jié)點(diǎn)
新增Service節(jié)點(diǎn)的name屬性依次修改為Catalina1啥寇、Catalina2……
新增Service節(jié)點(diǎn)的Connector節(jié)點(diǎn)port屬性依次修改為8001荠藤、8002……(根據(jù)機(jī)器配 置未占用端口斩个,這里按順序?yàn)榉奖悖?br>
新增Service節(jié)點(diǎn)的Host節(jié)點(diǎn)appBase屬性依次修改為webapps1半抱、webapps2…… 下面是新增兩個(gè)Service節(jié)點(diǎn)的配置:
具體配置代碼如下:
<Service name="Catalina1">
<Connector port="8081" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<Engine name="Catalina1" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps1"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
<Service name="Catalina2">
<Connector port="8082" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<Engine name="Catalina2" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps2"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
第二步:在$TOMCAT_HOME目錄下新建文件夾webapps1脓恕、webapps2……(目錄里包含ROOT子目錄),里面分別放不同項(xiàng)目(測試只就簡單復(fù)制$TOMCAT_HOME\webapps\ROOT 目錄)