Tomcat configures different ports for different applications

Source: Internet
Author: User

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 &quot;%r&quot; %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 &quot;%r&quot; %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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.