There are several ways to deploy Web apps in Tomcat:
- Leveraging Tomcat's automated deployment
Copy a web app to Tomcat's WebApps and the system will deploy the app to Tomcat. This is the simplest and most common way.
- Start Tomcat, in the command-Line Execution window, CD D:\Program files\java\apache-tomcat-8.0.23\bin, and then Startup.bat
- Browser Login http://localhost:8080
- Go to the Manager app console (need to add Username:manager,password in D:\Program files\java\apache-tomcat-8.0.23\conf\tomcat-users.xml : Manager,role:manager-gui)
- Go to the Manager console page, and in Deploy, enter the context path, such as/AAA, to enter the war or Directory URL, such as C:\Users\Lihaohong\Desktop\deloyTest
- Complete. is essentially using Tomcat's automated deployment
- To add a custom Web Deployment file
Under the Conf\catalina\localhost directory, create a new name for any XML file-the configuration file that deploys the Web app, and the file's primary file name 祝偶 the virtual path of the Web App.
For example, we add a dd.xml file under Conf\catalina\localhost\, the contents of which are as follows:
<docBase= "G:/publish/codes/01/aa" debug= "0" Privileged = "true"></Context>
The above configuration file docbase specifies the absolute path to the Web app, and starting Tomcat,tomcat again will deploy the Webdemo folder under that path as a web app. The URL address for the app is:
Http://<server_address>:<port>/dd
Where DD in the URL is the main name of the Web deployment file.
- Modify the Server.xml file Deployment Web App (you need to modify the Server.xml file in the Conf directory, modifying the file may corrupt Tomcat's system files, so it is not recommended)
How to deploy Web Apps in Tomcat