How to setup Virtual host in tomcat?

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?
Open tomcat/conf/server.xml
Give all the host name under section in server.xml
eg..
www.anand.com” appBase=”anand_webapps” unpackWARS=”true” autoDeploy=”true” />
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.

192.168.1.15 www.anand.com
192.168.1.15 www.anand1.com
192.168.1.15 www.anand2.com
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 in server.xml.
If mached with any host, then tomcat will be pointed to corresponding appBase folder given in host and the request will be processed.
Thats it..
Type ur host name in browser and check it
Refer :-