简体   繁体   中英

Deploy web application other than webapp folder in apache tomcat

I want to deploy web application in directory(eg \\Users\\username\\myapps\\app1) other than webapps folder.

I know to how to change "appBase" other than webapps by setting "appBase" attribute in "host" tag in server.xml in conf directory.

But problem is, I don't want to change whole webapps directory, I just want to deploy one application not in webapps directory.

Use a context.xml file placed in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory.

  • enginename -> server.xml - Server/Service/ Engine[@name] Default is Catalina .
  • hostname -> server.xml - Server/Service/Engine Host[@name] Default is localhost .

You can specify the absolute path or relative path in the docBase attribute.

<Context docBase="/Users/username/myapps/app1">
</Context>

See http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

PS (from the tomcat doc):

It is NOT recommended to place elements directly in the server.xml file. This is because it makes modifying the Context configuration more invasive since the main conf/server.xml file cannot be reloaded without restarting Tomcat.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM