Tomcat Configuration Virtual Host

Source: Internet
Author: User

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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.