Current location - Quotes Website - Team slogan - What is the main function of server.xml in tomcat? If the port conflict problem in tomcat is solved. The function of the following code in tomcat is
What is the main function of server.xml in tomcat? If the port conflict problem in tomcat is solved. The function of the following code in tomcat is
Server.xml contains the configuration of tomcat, including some ports, mappings and so on.

The default port of Tomcat is 8080. If it conflicts with other ports, look for the following code in server.xml

& lt connector port ="8080 "protocol ="HTTP/ 1. 1"

connectionTimeout="20000 "

redirectPort="8443" />

Just change 8080 to another port.

You can understand the context like this.

For example, if you have a project deployed under tomcat and its name is prj, you need to use the following address to access it.

http://localhost:8080/p0

If you want to directly access p0 project through http://localhost:8080/, you need to write it in the context.

& ltcontext path = " " docBase = " E:\ Tomcat \ web app \ P0 " debug = " 0 " reloadable = " true " cross context = " true "/& gt;

The path property is the name of the access directory after the url, and docBase is the path of the project.

If you want to access through http://localhost:8080/project, the context is as follows.

& lt context path = "/project" docbase = "e: \ Tomcat \ webapp \ P0" debug = "0". . . .

As you can understand, the context provides a different name for the deployed project. If there is no context, you need to add the project name after http://localhost:8080/ to access the project.