Static Deployment Copy the Web project file directly to the WebApps directory
Copy all content under the Webroot directory directly under the Web project to the WebApps directory under the Tomcat installation directory, which is the default application directory for the Tomcat directory, and each folder in the WebApps directory is an application. When the Tomcat server is started, all applications under the WebApps directory are loaded. For example, a Web project, TT, replicates all content directly under the Webroot directory of the TT project, creates a new TT directory under the WebApps directory, and pastes the copied content into the new TT directory under the WebApps directory.
for WebApps, the directory hosted by this tomcat default application is configurable and opens the following code found in the Server.xml file under the Tomcat directory below:
Modify AppBase to overwrite the default application directory for Tomcat. For example, change to Webs, then start Tomcat immediately under the Tomcat installation directory to create a new folder called Webs as a Tomcat application directory, the original deployment in the WebApps directory of applications are not accessible, such as Web application replication to the Webs directory to access. configuration in Server.xml files
In Tomcat's configuration file, a Web application is a specific context that deploys a JSP application by building a server.xml within the host node tag in the file.
Examples of this configuration are as follows: Access through http://localhost:8080/vc/.
Path =/VC is a virtual path for browsers to access Appliction projects
Docbase=d:\dev\appliction\webroot represents the real directory of Web engineering Webroot
or other cases.
or
<context path= "/myapp" reloadable= "true" docbase= "D:\myapp" workdir= "D:\myapp\work"/>
or
< Context path= "/SMS4" docbase= "D:\workspace\sms4\WebRoot"/>
Parameter description:
Path is a virtual path;
DocBase is the physical path of the application;
Workdir is the working directory for this application, which stores the files that are generated by the runtime in connection with this application;
Debug is set to debug level, 0 means to provide the least information, 9 to provide the most information
When privileged is set to True, Tomcat Web applications are allowed to use the servlet in the container
reloadable If True, Tomcat automatically detects changes in the application's/web-inf/lib and/web-inf/classes directories, automatically loading the changed application without reloading Tomcat. Implement Hot Deployment
antiresourcelocking and antijarlocking hot deployments are parameters that need to be configured, and the default false avoids updating a certain webapp, and sometimes Tomcat does not completely remove the old webapp. Typically, you leave a jar package under the Web-inf/lib and you must turn tomcat off to remove it, which causes automatic deployment to fail. Set to True,tomcat when running the corresponding WebApp, the corresponding source files and jar files are copied to a temporary directory. Create a context file to set up a single application
In the Conf directory, create a new Catalina\localhost directory, a new XML file in the directory, the name can not be arbitrarily taken, and the path after the name of the same, according to the configuration of this path below, The name of the XML should be VC (vc.xml), the contents of the XML file are as follows:
<context path= "/VC" docbase= "D:\Dev\appliction\WebRoot" debug= "0" privileged= "true" reloadable= "true" ></ Context>
The contents of the file are actually the same as the 2nd above, except that the Web application is deployed separately as an XML file, a file represents a Web application, and the file name is a virtual path. Delete an application
Deleting a Web application also deletes the corresponding context in the corresponding folder and Server.xml under WebApps, and deletes the corresponding XML file in Tomcat's Conf\catalina\localhost directory. Otherwise tomcat will still be configured and loaded. Dynamic Deployment
Login Tomcat Admin Console: http://localhost:8080/, enter user name and password then can manage application and publish dynamically. In the context Path (option): Enter/yourwebname, which represents the access address of your application. XML configration file URL to specify an XML document, such as we create a hmcx.xml file under F:\, which reads as follows: <context reloadable= "false"/> which docbase don't have to write. , because it is filled in the next text box. Or, more simply, this text box does nothing, type F:\HMCX in the war or Directory URL: And then click the Deploy button, where you can see the Web application, name in context Path (option): Name. If there is a simpler way to deploy the. war file, there is also a select War file uploae Click Browse to select the. war files, and then click Deploy.
Reference documents:
How Tomcat projects are deployed