Configuration of the Tomcat server-bound domain name

Source: Internet
Author: User
Tags net domain

Previously written to the deployment of the Tomcat server under Linux, in fact, as long as the domain name is properly resolved to the server, then do not have to bind the domain name is also able to access, such as by default access to xxx.net:8080 and www.xxx.net:8080 can be normal access, Because the default Tomcat binding location is localhost, and the host with WWW and the host without WWW have been parsed normally, so access is not any problem, then if we want to exactly bind a domain name how to do it, the method is as follows:

Use Vim to open the Conf/server.xml configuration file and locate the <Host> node, such as:

  

Here the Name property value, is to bind the domain name, default is localhost, we can change him to www.xxx.net

  

If we want to bind more than one domain name, because the <Host> node is under <Engline>, we need to add more <Host> nodes under <Engline>, configure multiple Web application directories, This will enable multi-domain access, relatively simple

After saving the changes, restart the Tomcat server, now access to take effect, but only bind www.xxx.net domain name, use xxx.net to access the 404 error, so it is recommended to bind multiple domain names, so that access is better

If all is the default, is localhost, then as long as the domain name is parsed, can be accessed, just this time we in Java program to determine the level two domain name, so that different responses can be, so it is more convenient

Configuration of the Tomcat server-bound domain name

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.