Name-Based Virtual Hosts

Name-Based Virtual Hosts

With growing use of internet, everyday thousands of sites are added on internet. We cannot setup separate servers for each site, so we need to create multiple sites on on a single server. With Name-Based Virtual Hosts, one instance of Apache hosts several domains.

The Name-Based Virtual Hosts concept gave the way to setup Shared & Reseller Hosting servers. In Name-Based Virtual Hosts, there is no need to set up multiple IPs for a server. The Apache documentation (apache.org) covers the reasons against the use of name-based virtual hosts.

You have to assign a suitable directive to activate Name-Based Virtual Hosts. (NameVirtualHost *). * is sufficient to prompt Apache to accept all incoming requests.

Following is the an example for VirtualHost entry:

ServerName www.eukhost.com

DocumentRoot /var/www/htdocs/eukhost.com

ServerAdmin [email protected]

ErrorLog /var/log/apache2/www.eukhost.com-error_log

CustomLog /var/log/apache2/www.eukhost.com-access_log combined

A * is used in VirtualHost as it is used in NameVirtualHost. When a domain is called in a browser, the host field in the http header is used by Apache to to connect the request to the virtual host.

This request is sent to the VirtualHost of the domain which is called.

For more information about our secure hosting solutions, visit our homepage.

Sharing