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
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
With the configuration in step 2, the multi-port is complete, and Tomcat is saved and started.
Access by using port 8080:
- 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
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
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
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)
Note: In contrast to the second case, the current situation should be applied very commonly.
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
Follow the configuration in step 2 to save and start Tomcat.
You can use domain1 access to Web1, and domain2 access to WEB2.
- 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)