Tested how Tomcat configures different ports for different applications, making a record of the Conf/server.xml configuration results below
<server port= "8005" shutdown= "Shutdown" >
<listener classname= "Org.apache.catalina.core.AprLifecycleListener" sslengine= "on"/>
<listener classname= "Org.apache.catalina.core.JasperListener"/>
<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= "8088" protocol= "http/1.1"
connectiontimeout= "20000"
redirectport= "8443"/>
<connector port= "8009" 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>
Unpackwars= "true" autodeploy= "true" >
<Alias>www.test3.com</Alias>
<valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "Logs"
prefix= "Localhost_access_log" suffix= ". txt"
pattern= "%h%l%u%t "%r" %s%b "/>
<context path= "" docbase= "D:\TomCat7.0\testapp\TestWebliu"/>
</Host>
</Engine>
</Service>
<service name= "Catalina2" >
<connector port= "880" protocol= "http/1.1"
connectiontimeout= "20000"
redirectport= "8443"/>
<connector port= "8010" protocol= "ajp/1.3" redirectport= "8443"/>
<engine name= "Catalina2" defaulthost= "localhost" >
<realm classname= "Org.apache.catalina.realm.LockOutRealm" >
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm"
Resourcename= "Userdatabase"/>
</Realm>
Unpackwars= "true" autodeploy= "true" >
<valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "Logs"
prefix= "Localhost_access_log" suffix= ". txt"
pattern= "%h%l%u%t "%r" %s%b "/>
<context path= "" docbase= "D:\TomCat7.0\testapp\TestWebliu"/>
</Host>
Unpackwars= "true" autodeploy= "true" >
<context path= "" docbase= "D:\TomCat7.0\testapp\TestWebliu"/>
</Host>
</Engine>
</Service>
</Server>
Under the server two service nodes, each service node can be configured with connector a listening port, service can have only one engine node, it accepts the sibling Directory Connector port request, You can use the Defaulthost property by default to point to a host,host that is a domain name under the connector port
That is: There can be multiple service under server to configure different listening ports, each service represents an application (only two service is configured)
There can be more than one host under service to configure different domain names under this port
The above configuration can be accessed using the following link:
http://127.0.0.1:8088/
http://www.test3.com:8088/
http://www.test2.com:880/
http://127.0.0.1:880/
test2,3 are all in the hosts, pointing to the local.
Alias under host is a nickname for a domain name.
The Context node under host is configured as: <context path= "", this directory is the default access directory, such as http://www.test2.com:880/, access to the D:\TomCat7.0\testapp\ Testwebliu the following file.
Tomcat configures different ports for different applications