Chapter 15: Shared Tomcat Hosting … The Connector configuration needs the useIPVHostssetting to be set to true(the default is false). This causes Tomcat to use the server name to do the matching for the virtual host, not the passed Host attribute in the HTTP header. To test this, configure your DNS entry for callisto.domand europa.dom to different IP addresses. If your server machine has just one NIC card, you can add a new aliased interface, as shown in the following command for Linux: $ ifconfig eth0:1 netmask In the test setup, you just add entries in the /etc/hostsfile for callisto.domand europa.dom, setting them to two different IP addresses configured for the server machine: 192.168.1.2 callisto.dom 192.168.1.20 europa.dom Now edit the Connector configuration in server.xml, set useIPVHoststo true, and restart Tomcat. Then, as before, view the test JSP page for each of the domains. First view the test page for callisto.dom browse to http://callisto.dom:8080/test.jsp, as shown in Figure 15-6 . Figure 15-6: test.jsp executing in the Callisto virtual host Next, repeat this test for europa.dom by browsing to http://europa.dom:8080/test.jsp, as shown in Figure 15-7 . As you can see in Figures 15-6 and 15-7 , the two virtual domains are at different IP addresses. This time around the correct host names are printed everywhere because there is just one virtual host per IP address.
For high quality website hosting services please check tomcat web hosting website.
This entry was posted
on Tuesday, September 29th, 2009 at 6:10 am and is filed under tomcat.
You can follow any responses to this entry through the RSS 2.0 feed.
Responses are currently closed, but you can trackback from your own site.