Chapter 15: Shared Tomcat Hosting The two IP addresses used in the directives should belong to network interfaces for the machine on which Apache would be running. You may have noticed that each of the Web sites has its own document root and its own log files for access and error logging. Various other directives can be placed in these virtual host definitions to enable further customization. Omitting these other directives would cause the virtual host to inherit any values from the global settings in the configuration file. Testing Your Configuration Finally, the following summarizes the steps you need to take to configure IP-based virtual hosting on Apache: 1. Make DNS changes, or edit the host file for the hosts that you wish to run Apache on. For IP-based virtual hosting, each host must have a unique IP address. You can use the ifconfig command to add a virtual interface if your machine does not have multiple network cards. 2. Edit Apache s httpd.confconfiguration file and add Listen directives for each of the virtual hosts, as shown in the previous section. Remove the existing Listen directive that listens on all network interfaces. 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 by either using the host names of the Web sites ( http://callisto.dom, http://europa.dom) or even the IP addresses ( http://192.168.1.2, http://192.168.1.20). Avoiding Common Mistakes Some common mistakes to avoid include the following: . Apache, in its default configuration, starts up and listens on all the configured network interfaces on the machine. If, for some reason, Apache is configured to listen on only a restricted number of IP addresses on the machine (using the Listen directive), it is important to ensure that Apache is listening on all the IP addresses of the various IP-based virtual hosts in order for all of them to work. . Using any random combination of IP addresses and Web host names will not always work as expected. This is commonly done by configuring the client machine to use a Domain Name Service (DNS) server. The Web client would query this DNS server for the IP address of the given host name, and then use the IP address returned by the DNS server to connect to the Web server. Similarly, the Web server would expect requests for the host name at the IP address specified in the corresponding NameVirtualHostdirective. . Needless to say, if the IP address given in the NameVirtualHost directive doesn t match the one returned by the DNS server for the host name, the Web client and the server won t be able to talk to each other.
If you looking for unlimited one inclusive web hosting plan please check cheap web hosting website.
This entry was posted
on Sunday, September 20th, 2009 at 8:21 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.