Today, we find that the Tomcat project on production only uses the ip+ port to access the project, it is very strange, baffled its solution, a variety of attempts, and finally find out why
Cases:
Http://192.168.50.248:8081/login.htm can go directly to the project login page
Http://192.168.50.248:8081/project/login.htm can also access the project login page
So, my local Tomcat tried, and found that if the project name is not added, access is 404,
Later I added the project name, login page can access, but login success, jump to Index.htm, the project name is missing and the response is 404
Later found that the original Tomcat is the default startup project, if you configure the Tomcat default startup Project , you can access the project without the project name
Here's how:
1. Open the Tomcat installation root directory, open the Conf directory under Service.xml, Locate the <Host> node, and add it under this node:
<context docbase= " /home/tomcat/webapps/project "path=" "debug=" 0 "reloadable=" true "/>
Description: Purple site for your project path, as I was placed in the WebApps directory, so point to WebApps
2. Open the WebApps directory under the Tomcat directory to find the root project and change it to another name
3. Restart Tomcat
Once the reboot is successful, the project can be accessed directly from the IP address + port in the browser.
Example: http://localhost:8081/login.htm
Finally: I still have a question , according to reason my first path has the project name, then my next relative path request should also have the project name
As if the http://192.168.50.248:8081/project/login.htm request is accessible to the login page, but why did I request success, return "/index",
Should return to http://192.168.50.248:8081/project/index.htm as normal.
But returned when the project name was also lost , the address into a http://192.168.50.248:8081/index.htm , this is my very doubtful place, tried a lot of places, do not know where to configure the
Tomcat can access projects with only IP and port without project name