Tomcat configuration completes the virtual host, you can build a Web site in a virtual host to create a Web site
First, in the D drive, create a newhost directory, copy the good Chapter02 application to the Newhost directory, and then change the contents of the welcome.html page to "This is Newhost file in welcome.html directory"
Configuring the Server.xml file
In the Server.xml file, add an element that
The Name property is set to: Itcast
The AppBase property is set to: D:\newhost
Specific code
Configure virtual host and IP
In the Hosts file of the Windows system, configure the mappings between the virtual host and the IP address
Specific code
127.0.0.1 Itcast
Note
Don't add the # number in front, #号表示注释
If you add the # number, you will not be able to access the Itcast virtual host to restart the Tomcat server
In the address bar of the browser, enter the address
Http://itcast:8080/chapter02/welcome.html
Show results