When tomcat is started, the tomcat container will get information about the internal elements, such as the name of the web project.
When a user requests a server, he first finds the tomcat container you started according to the requested first-level domain name. The container intercepts the requested project name after parsing the request character behind the first-level domain name, and sends the request information to the web project corresponding to the project name in the container according to the project name. Then, the web project processes the request, sends the response information to the container and returns it to the user.
In more detail.
Why does the request find an open tomcat server?
First, the address you requested is the ip address of this machine, so that the request can be sent to this machine. So how to give this machine tomcat focuses on the port. According to the port information of all open programs in this machine, the request will be given to the corresponding programs.
The default port of tomcat is 8080, so you need to add: 8080 in the request address. Of course, you can change the port of tomcat, such as 80, so you don't need to add: 8080 to the request address, because the ports within 100 will automatically match.