tomcat-project deployment location

Tomcat reads the projects under the webapps folder by default, because the following configuration in server.xml, appBase sets the project directory address.

<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
</Host>

 

There are three ways to modify the project deployment address and publish tomcat, which I have verified (tomcat8.0)

 

1. Obviously, modify the above appBase and change the value to the relative path to the tomcat home directory.

For example: create a new wtpwebapps folder in this directory, modify the appBase value to "wtpwebapps" and move the project to this folder, the project is published successfully

Or move the project to the parent directory and change the appBase value to "..", the project is published successfully

 

2. Add a child node to the <host/> node in the server.xml configuration file:

<Context path="/myapp" reloadable="true" docBase="D:\myapp" workDir="D:\myapp\work"/>

 illustrate:

path is the virtual path is the project address you enter in the browser

docBase is the physical path of the project

workDir working directory, used to store the files related to the application generated at runtime

If the reloadable value is true, tomcat will automatically detect changes in the application WEB-INF/lib and WEB-INF/classes directories, automatically load new programs, change programs without restarting tomcat, and achieve hot deployment

 

3. In the conf directory, create a new Catalina\localhost directory, and create a new xml file in this directory. The file name must be the same as the value of path in the file. The file name should be hello.xml for the following configuration

<Context path="/hello" docBase="E:\workspace\hello\WebRoot" debug="0" privileged="true"></Context>

 

 

Note: The third method can take effect directly during verification, and the first and second methods need to restart tomcat to take effect.

 

 

Reference document: http://blog.csdn.net/diamondy/article/details/7472411

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327061967&siteId=291194637