Tomcat configures multiple port numbers or multiple apps

Source: Internet
Author: User
Tags app service

One. under Tomcat, configure a single app service to configure multiple port numbers .

That is, one service configures multiple ports, and projects can be accessed through multiple ports.

Modify the Server.xml under Tomcat-home\conf, configure multiple <Connector> under service.

<service name= "Catalina" >
<Connectorconnectiontimeout= "20000"port= "8080"Protocol= "http/1.1" redirectport= "8443"/>
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>

<Connector port= "8099"Protocol= "http/1.1" maxthreads= "minsparethreads=" maxsparethreads= "75"
Enablelookups= "false" redirectport= "8443" acceptcount= "100"
debug= "0" connectiontimeout= "20000" uriencoding= "Utf-8"
Disableuploadtimeout= "true"/>

<engine defaulthost= "localhost" name= "Catalina" >
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase"/>
<HostAppbase= "WebApps" autodeploy= "true" name= "localhost" unpackwars= "true" Xmlnamespaceaware= "false" xmlvalidation= " False ">
</Host>
</Engine>
</Service> '

In this application, you can use the 8080 port number to access the service, you can also use the 8099 port number to access the service; The path of the service placement is determined by host, and the service is placed under WebApps in the example above.

That is, the following two ways of accessing the same project:

http://localhost:8080/Project Name

HTTP://LOCALHOST:8099/Project Name

Second, configure multiple services under a tomcat with a different port number .

That is, multiple service configurations can be configured with multiple ports per service.

Modify the Server.xml under Tomcat-home\conf to add multiple service.

Note the service name, Engine name, AppBase, Don't forget to change the port number to avoid duplication

<service name= "Catalina">
<connector connectiontimeout= "20000"port= "8080"Protocol= "http/1.1" redirectport= "8443"/>
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
<engine defaulthost= "localhost" name= "Catalina">
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase"/>
WebApps"Autodeploy=" true "name=" "localhost" unpackwars= "true" Xmlnamespaceaware= "false" xmlvalidation= "false" >
</Host>
</Engine>
</Service>

<service name= "Catalina1">
<connector connectiontimeout= "20000"port= "8099"Protocol= "http/1.1" redirectport= "8443"/>
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
<engine defaulthost= "localhost" name= "Catalina1">
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase"/>
Webapps1"Autodeploy=" true "name=" "localhost" unpackwars= "true" Xmlnamespaceaware= "false" xmlvalidation= "false" >
</Host>
</Engine>
</Service>

<service name= "Catalina2">
<connector connectiontimeout= "20000" port= "8098" Protocol= "http/1.1" redirectport= "8443"/>
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
<engine defaulthost= "localhost" name= "Catalina2">
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase"/>
WEBAPPS2"Autodeploy=" true "name=" "localhost" unpackwars= "true" Xmlnamespaceaware= "false" xmlvalidation= "false" >
</Host>
</Engine>
</Service>

The above three service, publish the path different, the project publishes separately in WebApps, WEBAPPS1, WEBAPPS2,

Ways to access different projects:

http://localhost:8080/Project Name 1

HTTP://LOCALHOST:8099/Project Name 2

http://localhost:8088/Project Name 3

Resources:

http://linder.iteye.com/blog/782071

Http://it.chinawin.net/softwaredev/article-c4d0.html

http://my.oschina.net/u/865478/blog/177618

Tomcat configures multiple port numbers or multiple apps

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.