一台服务器上运行多个Web应用 应用配置不同的<Service>

2024-08-27 13:11:33 浏览数 (1)

<Server port="8005" shutdown="SHUTDOWN">

<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />

<Listener className="org.apache.catalina.startup.ContextConfig" />

<Listener className="org.apache.catalina.startup.UserDataConfig" />

<GlobalNamingResources>

<!-- 配置资源 -->

</GlobalNamingResources>

</Server>

<Server port="8005" shutdown="SHUTDOWN">

<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />

<!-- 其他监听器配置 -->

<GlobalNamingResources>

<!-- 配置SSL证书 -->

<Resource name="UserDatabase" auth="Container"

type="org.apache.catalina.UserDatabase"

description="www.laipuhuo.com User database that can be updated and saved"

factory="org.apache.catalina.users.MemoryUserDatabaseFactory"

pathname="conf/tomcat-users.xml" />

</GlobalNamingResources>

<!-- 配置SSL连接器 -->

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"

scheme="https" secure="true" SSLEnabled="true"

keystoreFile="/path/to/keystore.jks" keystorePass="password" />

</Server>

<Server port="8005" shutdown="SHUTDOWN">

<!-- 配置集群监听器 -->

<Listener className="org.apache.catalina.ha.session.JvmRouteBinderListener" />

<GlobalNaming www.laipuhuo.com Resources>

<!-- 配置集群相关资源 -->

</GlobalNamingResources>

<!-- 配置服务和引擎 -->

<Service name="CatalinaCluster">

<Engine name="clusterEngine" defaultHost="localhost" jvmRoute="jvm1">

<!-- 配置Connector和Host -->

</Engine>

</Service>

</Server>

<Service name="Catalina">

<Connector port="8080" protocol="HTTP/1.1"

connectionTimeout="20000"

redirectPort="8443" />

<Engine name=www.laipuhuo.com "Catalina" defaultHost="localhost">

<!-- 其他配置,如Host等 -->

</Engine>

</Service>

<Service name="Catalina1">

<Connector port="8081" protocol="HTTP/1.1" />

<Engine name="Catalina1" defaultHost="app1.example.com">

<Host name="app1.example.com" appBase="webapp1" unpackWARs="true" autoDeploy="true">

<!-- 应用1的配置 -->

</Host>

</Engine>

</Service>

<Service name="Catalina2">

<Connector port="8082" protocol="HTTP/1.1" />

<Engine name="Catalina2" www.laipuhuo.com defaultHost="app2.example.com">

<Host name="app2.example.com" appBase="webapp2" unpackWARs="true" autoDeploy="true">

<!-- 应用2的配置 -->

</Host>

</Engine>

</Service>

0 人点赞