Modify the default directory of tomcat under linux

2. To modify the default directory, add one:
 <Context path=”” docBase=”/home/tomcat/javapage” debug=”0″ reloadable=”true” />


After restarting tomcat in this way, he will change webapps/ROOT in the default directory to home/tomcat/javapage.

3. If you want to add a second-level domain name or folder under the javapage directory, just add such a statement to the above statement, such as:
<Context path=”/lilyfl” docBase=”/home/tomcat /javapage” debug=”0” reloadable=”true” />
In this way, to access the lilyfl directory is to enter: http://localhost:8080/lilyfl/ and you can access it.

4. Or the directory of the address http://hostlocal:8080/lilyfl/ you want to visit does not want to be placed in the javapage directory, but in /opt/lilyfl, so you only need to modify the docBase, such as:
<Context path =”/lilyfl” docBase=”/opt” debug=”0″ reloadable=”true” />

5. Sometimes if the key value of path is empty, it is the default directory webapps/ROOT of tomcat. If you want to access a lilyfl directory under the default directory, you can add docBase, such as:
<Context path=”" docBase=” ceeey” debug=”0″ reloadable=”true” />
When visiting, it is 
http://www.ceeey.com : 8080/ceeey/

6. By the way, modify the port of tomcat. In server.xml in the conf directory, there is the following paragraph:
<Connector port=”8080” protocol=”HTTP/1.1”
               connectionTimeout=”20000”
               redirectPort=”8443” />
Modify the port after the port inside.
After modification, remember to restart tomcat.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326349682&siteId=291194637
Recommended