Virtual hosting means, setting up many websites under single tomcat.
That is hosting many websites into single tomcat.
What is the use of Virtual host method?
Virtual hosting is what most personal and small websites use for hosting. Instead of having a dedicated IP and machine where only your website lives, your site is hosted on a server with a bunch of other websites. In fact, most hosting today is on a virtual host.
For example if you want to run many website means, u should have to buy hosting space or server.
Instead of buying server/space you d\can deploy all your webapplications into single tomcat.
This process is called as Virtual hosting.
Where to configure?
Give all the host name under section
Copy tomcat/webapps folder and copy it parallel to webapps folder and rename it to appBase name in
And deploy a war file into each appBase folders.
like this you can host any number of websites.
We can simulate the DNS setup in /etc/hosts file.
Open file /etc/hosts and give the following entries.
How it is working?
Each and every tomcat request will have details about the host in header. This host header will be checked with host’s which are given under section
If mached with any host, then tomcat will be pointed to corresponding appBase folder given in host and the request will be processed.
Type ur host name in browser and check it