such as http://localhost:8080/myweb/index.jsp into www.melody.com
1. Add key-value pairs 127.0.0.1 www.melody.com in the Hosts file
2. Locate Server.xml in the Conf directory of Tomcat and add it under the
name: Set the virtual host name as localhost, please fill in the specific domain name in actual case
appBase: The directory where the application is stored
Context Path : Virtual directory, such as "/web", we access address www.melody.com/web as "/", Access address is www.melody.com
docBase:directory for Web applications
The host node also has 2 properties one for Autodeploy,unpackwars
unpackwars: If True,tomcat will automatically extract the war file
Autodeploy: If True, automatic deployment, Tomcat automatically detects file changes under the AppBase directory and automatically applies to the running WEB application.
<= "www.melody.com"="> < = "/" = "D:\myweb"/> </Host >
3. Modify the Web. XML in the project to set the first page (to set the index.jsp as the main page)
< welcome-file-list > < Welcome-file >index.jsp</welcome-file></welcome-file-list >
How do I set the local domain name to what you need?