Tomcat implements Multiport, multi-domain access (only for one tomcat)

Source: Internet
Author: User

    1. Description: This section describes how to configure in Tomcat so that the same app can be accessed through a different port number.

      In some scenarios where security control is required. For example, different address segments can only be accessed through a port.

    2. 2

      Locate the Tomcat home directory, open the Conf folder, and locate 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"/& Gt

    3. 3

      With the configuration in step 2, the multi-port is complete, and Tomcat is saved and started.

      Access by using port 8080:

    4. 4

      Access by using port 9090:

      In this way, a different port number is implemented to access the same application. If you still want to listen on other ports, add a few more to the content in step 2.

      END
Tomcat for multi-domain access (via the same port number)
  1. 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 Management Server supports 2 different domain names mapped to the same port on the same IP address.

  2. 2

    Find the home directory of Tomcat, open the Conf folder, locate and open the Server.xml file.

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

         

  3. 3

    Follow the configuration in step 2 to save and start Tomcat.

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

    END
Tomcat for multi-domain access (using a different port number)
    1. Note: In contrast to the second case, the current situation should be applied very commonly.

    2. Locate the Tomcat home directory, open the Conf folder, and locate and open the Server.xml file.

      Edit the Server.xml file, copy the <Service>...</Service> tag, and modify the Service name, listening port, domain name, default loaded application.

    3. 3

      Follow the configuration in step 2 to save and start Tomcat.

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

    4. 4

      Description: The third case is the biggest difference from the second situation is the use of another port number, which is also common situation. (different domain names are mapped to different ports)

      END
Precautions
    • To use domain name access, users have to first obtain the domain name address.
    • Through the domain Management service, the domain name address to be resolved to the IP address + port number.

Tomcat implements Multiport, multi-domain access (only for one tomcat)

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.