Tomcat Virtual Host Configuration

Source: Internet
Author: User
Tags domain name registration
3.1 configure Virtual Hosts

A website is configured as a virtual host.
To configure a virtual host (website) on the Tomcat server, you must modify the server in the conf folder. the xml configuration file uses the host element for configuration to open the server. XML, you can see that the Tomcat server comes with a virtual host (website) named localhost, as shown in:

Put the developed Java Web application in the webapps folder, and then you can access it using "http: // localhost: Port Number/javawebappname,

The access is the virtual host whose name is "localhost". This virtual host manages all web applications in the webapps folder.


You can configure a virtual host as follows:

 <Host name="www.dujiechn.cn" appBase="F:\JavaWeb">       </Host>

Here we configure a new virtual host,

The VM name is "www.dujiechn.com", and the VM "www.dujiechn.com" manages all web applications in the javawebapps folder.

When we use the domain name "www.baidu.com" on the Internet to access Baidu's website, we actually access a VM named "www.baidu.com, so when we want to access this virtual host named "www.dujiechn.com", we can use "Domain Name (www.dujiechn.com)" to access

Note: appbase = "F: \ javawebapps". The javawebapps folder here represents not the root directory of a project, but a folder that stores one or more javaweb applications, as shown in:

Domain name registration in Windows

To access the configured host (website) externally through the domain name, you must register the domain name used to access the website on the DNS server or Windows system and find"C: \ windows \ system32 \ drivers \ etc"Hosts file under the directory, bind the domain name and IP address of the newly added website together, in this way, we can use the domain name www.dujiechn.com in the browser to access the Web applications managed in the virtual host www.dujiechn.com.

Open the Tomcat server and enter the domain name in the address bar.

 

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.