Chapter 15: Shared Tomcat Hosting The additional Host: header in the client request helps the Web server distinguish between all the domains that share the same IP address. Configuring Name-Based Virtual Hosting in Apache Implementing name-based virtual hosting in Apache is not very different from implementing IP-based virtual hosting. It requires only the addition of the NameVirtualHost directive. This directive configures the IP address on which the Apache server will receive HTTP requests for the name-based virtual hosts. Documents should be subsequently fetched depending on the value of this parameter and the related virtual host definition specified later in the configuration. A sample Apache name-based configuration for a Linux/Unix system would look like the following: Listen 80 … NameVirtualHost 192.168.1.2 ServerName europa.dom DocumentRoot /home/websites/europa.dom/web ServerAdmin support@europa.dom ErrorLog /home/websites/europa.dom/log/error TransferLog /home/websites/europa.dom/log/access 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 In this configuration, two Web sites, europa.domand callisto.dom, are being hosted on the same IP address: 192.168.1.2. After a request comes to the IP address, Apache uses the Host:parameter and the ServerNameparameter of each of the virtual host definitions to determine the definition to which this request should be sent. The only configuration that must be specified in order to use name-based virtual hosting is to set up DNS settings for each of the FQDNs to be hosted so that the client can resolve the IP addresses correctly. Compare this to IP-based virtual hosting, whereby each of the IP addresses also had to be configured on the network interfaces of the machine. You can even do name-based virtual hosts with the different sites running on different ports on the same IP address as shown: Listen 80 Listen 8000 … NameVirtualHost 192.168.1.2:80 NameVirtualHost 192.168.1.2:8000 ServerName europa.dom DocumentRoot /home/websites/europa.dom/web ServerAdmin support@europa.dom ErrorLog /home/websites/europa.dom/log/error TransferLog /home/websites/europa.dom/log/access (continued)
For high quality website hosting services please check tomcat web hosting website.
This entry was posted
on Monday, September 21st, 2009 at 5:16 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.