Developing a good web application that wants to be accessed by the outside world, in addition to installing a Web server, needs to map the Web application to a virtual Web directory that is accessible to the outside world, a process called Configuring the Web application virtual directory
The Tomcat server starts with version 6.0, automatically manages the web app under the WebApps directory, and uses the name of the Web App directory as the virtual directory name
Therefore, the Tomcat directory
WebApps directory, can be directly accessed by the outside world
Other directories that cannot be accessed directly by the outside world
Configure the Web App virtual directory
Under Tomcat WebApps, create a new directory Chapter02,chapter02 the name of the Web app, and then, in the Chapter02 directory, creates a welcome.html file that writes "Welcome to my Blog"
Start the Tomcat server and enter it in the browser address bar
Http://localhost:8080/chapter02/welcome.html
Visit the welcome.html page with the following results
Description, Web applications placed in the WebApps directory can be accessed directly by the outside world
If you put all your web apps in the WebApps directory, it's unreasonable, and sometimes you put web apps in other directories
Cut the Chapter02 directory into the D-Packing directory, open Internet Explorer and revisit the app, and the browser will have a 404 error
For error reasons, Tomcat cannot manage Web applications other than the <tomcat installation directory >/webapps directory
At this point, the Web app wants to be accessed by the outside world and needs to manually configure the virtual directory to configure the virtual directory on the Tomcat server in two ways
1. In the Server.xml file, configure the virtual directory
2. In the custom XML file, configure the virtual directory