Chapter 15: Shared Tomcat Hosting ServerName callisto.dom DocumentRoot

Chapter 15: Shared Tomcat Hosting ServerName callisto.dom DocumentRoot /home/websites/callisto.dom/web ServerAdmin support@callisto.dom ErrorLog /home/websites/callisto.dom/log/error TransferLog /home/websites/callisto.dom/log/access As mentioned earlier in the chapter, some old browsers do not send the Host: header required for name-based virtual hosting to work. There is a workaround in Apache for these browsers using the Apache ServerPath directive. To use this directive, add the following to the virtual host settings: NameVirtualHost 192.168.1.2 ServerName europa.dom ServerPath /europa DocumentRoot /home/websites/europa.dom/web ServerAdmin support@europa.dom ErrorLog /home/websites/europa.dom/log/error TransferLog /home/websites/europa.dom/log/access … Once this is done, all requests for a Web page containing /europa can be accessed by older browsers (the ones that don t send the Host:parameter) at http://europa.dom/europa, and by the modern browsers at http://europa.dom. The Web developer would need to make sure that both locations work, for example by putting links between the two locations. This is not a clean workaround; if an older browser doesn t send a Host: parameter and requests http://callisto.dom/europa for instance, Apache serves up content for the europa.dom Web site and not callisto.dom! Testing Your Configuration Finally, the following summarizes the steps you need to take to configure name-based virtual hosting on Apache: 1. Make DNS changes, or edit hosts file for the hosts that you wish to run Apache on. In name- based virtual hosting, different host names can share the same IP address. 2. Edit Apache s httpd.confconfiguration file and add NameVirtualHost directives for each of the virtual hosts as shown in the previous section. 3. Edit the httpd.confconfiguration file and add VirtualHostsections for each of the virtual hosts, as shown in the previous section. 4. Make sure that the DocumentRootin each VirtualHostsection points to the location of the Web site content for the virtual host. 5. Restart Apache using the apachectlcommand. You should now be able to start your browser and view the respective Web sites. You can do this using only the host names of the Web sites ( http://callisto.dom, http://europa.dom). If you use the IP

For high quality java hosting services please check tomcat web hosting website.

Comments are closed.