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