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.