At the moment, many servers are a server that has access to a number of Java EE projects, and this implementation requires a virtual host to be configured in Tomcat. Let's talk about how to configure a virtual host:
Locate the Tomcat installation directory, go to the tomcat_home/apache-tomcat7/conf directory, locate the Server.xml file, open the file, and find the child node about engine in the file.
<engine name= "Catalina" defaulthost= "localhost" >
The above configuration has a localhost representation in a defaulthost as the default access method. We need to configure our own remember to add the host node to the engine node, the default one is the following:
The name inside this refers to accessing the local localhost address, appbase represents the parent location specified by the project, and the current WebApps representative: Tomcat_home/apache-tomcat7/webapps this location, This location is also the default hosting Java EE project location for Tomcat.
Here is a virtual host that I have configured myself:
In detail: The host node is represented as a virtual host, name indicates the domain name that needs to be accessed, and this domain name is the domain name that has already been registered. Currently configured domain name: Www.abc.net under host has a child node, called Alias, which is configured in another domain name, that is, a virtual host, you can use multiple domain names.
So access to Www.abc.net and ABC.com is the same.
AppBase needs you to specify the project parent path, under the current path can hold multiple projects, we can package the project or put the folder in the/var/javaserver/test directory
Unpackwars= "True" indicates that decompression is enabled when a packaged war project is found in/var/javaserver/test.
Autodeploy= "True" indicates support for hot deployment.
Here's the context node under the host node, which is deploying a project, but this project is not in the AppBase directory, his path is in/var/www/html/hello directory, path represents the name of the external access, This makes tomcat flexible and changeable.
About Tomcat configuration Virtual host I'm talking about this. If you don't understand, you can contact me.
Author:spring Sky
email:vipa1888@163.com
qq:840950105