Tomcat Virtual Host Configuration

Source: Internet
Author: User

At the moment, a lot of servers are a single server that can be used to ask a lot of javaee projects externally. This implementation method requires configuring the virtual host in tomcat! The following describes how to configure a VM:

 

Find the tomcat installation folder, go to the tomcat_home/apache-tomcat7/conf folder, find the server. xml file, open the file, find the sub-node about engine in the file

  <Engine name="Catalina" defaultHost="localhost">


The localhost in defaulthost is configured as the default issue method! We need to configure our own remember to add the host node to the engine node. The default host is as follows:

 

  <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">


The name in this field indicates the localhost address of the local device, appbase indicates the parent location specified by the project, and the current webapps indicates the location of tomcat_home/apache-tomcat7/webapps, this location is also the default location for storing javaee projects in tomcat!

 

The following is a self-configured Virtual Host:


 

<Host name="www.abc.net" appBase="/var/JavaServer/test" unpackWARs="true" autoDeploy="true">      <Alias>abc.com</Alias>       <Context path="/hello" docBase="/var/www/html/hello" debug="0" privileged="true"/>     </Host>

 

For details, the host node represents a virtual host, and the name indicates the domain name to be renewed. This domain name is already registered! The currently configured Domain Name: www.abc.net has a subnode named alias under the host, which is configured with another domain name, that is, a virtual host can use multiple domain names!
In this case, www.abc.net and abc.com are the same!

 

Appbase requires that you specify the project parent path. The current path can store multiple projects. We can package or put the project in the/var/assumerver/test folder.

Unpackwars = "true" indicates that the decompression function is enabled when/var/JavaServer/test has a packaged war project!

Autodeploy = "true" indicates that hot deployment is supported!

 

The following describes the context node under the host node. This is to deploy a project, but this project is not in the appbase folder, the path is in the/var/www/html/Hello folder, and path indicates the name of the external question, which makes Tomcat flexible!

 

I also talked about Tomcat's virtual host configuration. If you have any questions, contact me.

 

author:spring skyEmail:[email protected]QQ: 840950105


 

 

Tomcat Virtual Host Configuration

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.