Way One:
Inside the <Host> tag under the <Engine> tab in the Tomcat]/conf/server.xml file, add a
<context path= "/news1" docbase= "E:\web\news1"/>
--><context path= "" docbase= "E:\web\news1"/> default access to Web direct localhost/html files
--If you need to access the virtual host (site) directly through http://localhost, you will need to find the Web-inf/web.xml under the current Web application and add the following configuration under the Root tab:
<welcome-file-list>
<welcome-file> 1.html (page that needs to be set as homepage) </welcome-file>
<welcome-file> 2.html (if the page above does not exist then this page will be set to the homepage) </welcome-file>
</welcome-file-list>
One of the context represents a Web application
Docbase used to point to the real path of the web App
Path is used to point to the virtual path of the Web App.
If you want to represent a multilevel path, you can refer to the following configuration: Path= "/NEWS1/A/B/C"
This method is not recommended, because each configuration will need to restart the server before it can play a role!
Way Two
In the [tomcat]/conf/catalina/[host]/directory, add a xx.xml file, the contents of the file are as follows:
<context docbase= "E:\web\news2"/>
Where the file name is the virtual path to the Web app's external access (if you need to set it to default access, change the file name directly to root --it must be the root of the capitalization)
--If you need to access the virtual host (site) directly through http://localhost, you will need to find the Web-inf/web.xml under the current Web application and add the following configuration under the Root tab:
<welcome-file-list>
<welcome-file> 1.html (page that needs to be set as homepage) </welcome-file>
<welcome-file> 2.html (if the page above does not exist then this page will be set to the homepage) </welcome-file>
</welcome-file-list>
Docbase used to point to the real path of the web App
If you want to represent a multilevel path, you can replace the slash with # in the file name
such as: News2#a#b#c.xml
This method does not need to restart the server can play a role!
Mode three
During the configuration of the virtual host, you can configure the default managed directory for the virtual host, and you can deploy the Web app directly to the Web app's default managed directory !
The name of the folder is the virtual path to the Web app's external access (if you need to set it to default access, change the folder name to root--it must be the capitalization root)
--If you need to access the virtual host (site) directly through http://localhost, you will need to find the Web-inf/web.xml under the current Web application and add the following configuration under the Root tab:
<welcome-file-list>
<welcome-file> 1.html (page that needs to be set as homepage) </welcome-file>
<welcome-file> 2.html (if the page above does not exist then this page will be set to the homepage) </welcome-file>
</welcome-file-list>
This method does not need to restart the server can play a role!
Three ways to deploy Web apps to virtual hosts