The automatic deployment process identifies new and/or modified web applications using the following search order:安全
Web applications with a context.xml file located in the Host's configBase.
Web applications with a WAR file located in the Host's appBase that have not already been identified during the scan for context.xml files.
Web applications with a directory located in the Host's appBase that have not already been identified during the scans for context.xml and/or WAR files.
當不在webapps的目錄下的時候須要設置docBase服務器
When using automatic deployment, the docBase defined by an XML Context file should be outside of the appBase directory. If this is not the case, difficulties may be experienced deploying the web application or the application may be deployed twice. The deployIgnore attribute can be used to avoid this situation.架構
Note that if you are defining contexts explicitly in server.xml, you should probably turn off automatic application deployment or specify deployIgnore carefully. Otherwise, the web applications will each be deployed twice, and that may cause problems for the applications.app
Individual Context elements may be explicitly defined:webapp
In an individual file at /META-INF/context.xml inside the application files. Optionally (based on the Host's copyXML attribute) this may be copied to $CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to application's base file name plus a ".xml" extension.
In individual files (with a ".xml" extension) in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory. The context path and version will be derived from the base name of the file (the file name less the .xml extension). This file will always take precedence over any context.xml file packaged in the web application's META-INF directory.
Inside a Host element in the main conf/server.xml.
Default Context elements may be defined that apply to multiple web applications. Configuration for an individual web application will override anything configured in one of these defaults. Any nested elements, e.g. elements, that are defined in a default Context will be created once for each Context to which the default applies. They will not be shared between Context elements.
In the $CATALINA_BASE/conf/context.xml file: the Context element information will be loaded by all web applications.
In the $CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all web applications of that host.
With the exception of server.xml, files that define Context elements may only define a single Context element.