Tomcat multi-port multi-application and tomcat port application

Source: Internet
Author: User

Tomcat multi-port multi-application and tomcat port application
Tomcat starts from D:/Tomcat5.0/conf/server at startup. xml to obtain some basic information about server startup. in xml, you will see this node, as shown below:



<Service name = "Catalina">
<Connector acceptCount = "100" connectionTimeout = "20000" disableUploadTimeout = "true" port = "8080" redirectPort = "8443" maxSpareThreads = "75" maxThreads = "150" minSpareThreads =" 25 "/>
<Connector port = "8009" protocol = "AJP/1.3" protocolHandlerClassName = "org. apache. jk. server. JkCoyoteHandler" redirectPort = "8443"/>
<Engine defaultHost = "localhost" name = "Catalina">
<Host appBase = "webapps" name = "localhost">
<Logger className = "org. apache. catalina. logger. FileLogger" prefix = "localhost_log." suffix = ". txt" timestamp = "true"/>
</Host>
<Logger className = "org. apache. catalina. logger. FileLogger" prefix = "catalina_log." suffix = ". txt" timestamp = "true"/>
<Realm className = "org. apache. catalina. realm. UserDatabaseRealm"/>
</Engine>
</Service>

The first node under the node defines the listening port. The above example is 8080. For the node itself, the value of its attribute name is Catalina, which is a key point, followed by a subnode, and its attribute defaultHost is localhost, this is also a key point.
We can find a folder named Catalina under D:/Tomcat5.0/conf, which also contains a folder named localhost. The localhost folder contains a lot of xml, which is the Context configuration file of each Web Application. Based on this information, it is easy to think of the method to establish two Web servers.
First, create a folder named Fantasysoft in D:/Tomcat5.0/conf, and then create a localhost folder under Fantasysoft, then, place the Context configuration file of the corresponding Web Application to the newly created localhost folder;
Then, add a node against an existing node in server. xml, change the name attribute to Fantasysoft, and modify the port ports accordingly. As follows:



<Service name = "Fantasysoft">
<Connector acceptCount = "100" connectionTimeout = "20000" disableUploadTimeout = "true" port = "8090" redirectPort = "8453" maxSpareThreads = "75" maxThreads = "150" minSpareThreads =" 25 "/>
<Connector port = "8019" protocol = "AJP/1.3" protocolHandlerClassName = "org. apache. jk. server. JkCoyoteHandler" redirectPort = "8453"/>
<Engine defaultHost = "localhost" name = "Catalina">
<Host appBase = "webapps" name = "localhost">
<Logger className = "org. apache. catalina. logger. FileLogger" prefix = "localhost_log." suffix = ". txt" timestamp = "true"/>
</Host>
<Logger className = "org. apache. catalina. logger. FileLogger" prefix = "catalina_log." suffix = ". txt" timestamp = "true"/>
<Realm className = "org. apache. catalina. realm. UserDatabaseRealm"/>
</Engine>
</Service>

Finally, restart the Server to access your network through port 8090.

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.