A method to realize multi-port and multiple domain name access for Tomcat _tomcat

Source: Internet
Author: User
Tags tomcat

1, find Tomcat's home directory, open the Conf folder, find and open the Server.xml file.

Edit the Server.xml file and add it to the <Service></Service> tab:

<connector port= "9090" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>

As shown in figure:

2, the configuration in step 1, multiple ports are complete, save and start Tomcat.

Effects using 8080-Port access chart:

3, using 9090-port access to the effect of the map:

This enables different port numbers to be accessed to the same application. If you want to listen on another port, add a few more to step 2.

Second, tomcat to achieve multiple domain name access (through the same port number)

1. Description: In the case of the same port number, Tomcat can configure different domain names to correspond to different applications.

However, I am not sure whether the Domain name Management Server supports 2 different domain names mapped to the same port of the same IP address.

2, find Tomcat's home directory, open the Conf folder, find and open the Server.xml file.

Edit the Server.xml file and add it to the <Service></Service> tab:

 
 

As shown in figure:

3

3, proceed to the configuration in step 2, save and start Tomcat.

You can use domain1 access to Web1, and domain2 access to WEB2.

Three, tomcat to achieve multiple domain name access (using different port number)

1. Description: Relative to the second situation, the current situation should be widely used.

2, find Tomcat's home directory, open the Conf folder, find and open the Server.xml file.

Edit the Server.xml file and make a copy of the <Service>...</Service> label, modifying the Service name, listening port, domain name, and default loading application.

As shown in figure:

3

3, proceed to the configuration in step 2, save and start Tomcat.

You can use domain1 access to Web1, and domain2 access to WEB2.

4, note: The third situation and the second case the biggest difference is the use of another port number, which is also a common situation. (different domain name map to different port) end note To use domain name access, the user must first get the domain name address. Through Domain name Management Service, domain name address to be resolved into IP address + port number.

Summarize

The above is the entire content of this article, I hope the content of this article for everyone's study or work can help, if there is doubt you can message exchange.

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.