GDreams0 2015-10-29
1个tomcat部署多个web应用可以设置不同编码,端口,server.xml配置如下:
<?xml version='1.0' encoding='utf-8'?>
<Server port="8014" shutdown="SHUTDOWN">
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener classname="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener classname="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener classname="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener classname="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener classname="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="9091" protocol="HTTP/1.1"
connectionTimeout="60000" maxThreads="450" redirectPort="8443" URIEncoding="UTF-8"/>
<Connector port="18014" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm classname="org.apache.catalina.realm.LockOutRealm">
<Realm classname="org.apache.catalina.realm.UserDatabaseRealm"
resourcename="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="D:\cjktest\tomcat71\webapps\cgplatform" reloadable="true" />
</Host>
</Engine>
</Service>
<Service name="Catalina1">
<Connector port="9092" protocol="HTTP/1.1"
connectionTimeout="60000" maxThreads="450" redirectPort="8443" URIEncoding="UTF-8"/>
<Connector port="28014" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm classname="org.apache.catalina.realm.LockOutRealm">
<Realm classname="org.apache.catalina.realm.UserDatabaseRealm"
resourcename="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="D:\cjktest\tomcat71\webapps\cgcoms" reloadable="true" />
</Host>
<!--
<Host name="passport.caibab.com" appBase="/home/software/tomcat_cas"
unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/home/software/tomcat_cas/webapps/cgcas" reloadable="true" />
</Host>
-->
</Engine>
</Service>
</Server>