Chapter 15: Shared Tomcat Hosting Figure 15-7: test.jsp executing in the Europa virtual host The same useIPVHosts parameter is used to support IP-based virtual hosting with an AJP Connector, too. Finally, the following is a summary of the steps you need to take to configure IP-based virtual hosting in Tomcat (standalone): 1. Make DNS changes, or edit hosts file for the hosts that you wish to run Tomcat on. For IP-based virtual hosting, each host must have a unique IP address. You can use the ifconfigcommand to add a virtual interface if your machine does not have multiple network cards. 2. Create your deployment structure for the virtually hosted Web sites this is required when setting the appBase for the Web site s entries. 3. Edit Tomcat s server.xml, and add the useIPVHosts= true attribute to the Connector configuration. 4. Edit Tomcat s server.xml, and modify the directive, setting the default virtual host, as shown earlier. 5. Add entries inside the directive for each virtual host. 6. Make sure that the appBasein each points to the location of the Web site content for that host. 7. Optionally configure access log Valves and contexts for each host. 8. Restart Tomcat. You should now be able to start your browser and view the respective Web sites. You can do this using the host names of the Web sites as well as the IP addresses. Tomcat with Apache When Tomcat is used as an out-of-process servlet container along with Apache, two sets of configuration must be done: one in Tomcat and the other in Apache. For Tomcat, the configuration shown in the preceding section remains more or less the same. The only difference is that you can disable the HTTP Connector in the server.xmlconfiguration file because it is not being used.
For reliable and cheap web hosting services please check javaweb hosting website.
This entry was posted
on Tuesday, September 29th, 2009 at 11:26 pm 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.