Tomcat 7 supports name-based virtual hosting. This approach is very useful in hosting multiple web applications on the single instance of Tomcat 7. It also gives more privileges to the administrator to separate the applications from each other and their access control restrictions. You cannot understand the real concept of virtual hosting unless you implement it. So why wait, let's do the real-life implementation for virtual hosting in Tomcat 7.
For example, if you want to host the previously mentioned sites on the web server, then the DNS will be configured in the following manner. Let us assume the web server name is
webserver1.yxz.com and is hosted on the IP 192.168.0.1. To implement the previous scenario, the following steps need to be performed:
1. Configure the domain names in the DNS server and reload the DNS services so that it can be replicated on the server. Following are the DNS records with the address and CNAME: