Home arrow Apache arrow Configuring and Using Virtual Hosts in Apache

Configuring and Using Virtual Hosts in Apache

Begin creating and managing virtual hosts with Apache with this clear explanation from Dan Wellman. He explains what virtual hosts are and illustrates a basic way of setting up virtual hosts.

TABLE OF CONTENTS:
  1. Configuring and Using Virtual Hosts in Apache
  2. Edit the Main Configuration File
  3. Virtual Host
  4. Find File System Called Hosts
By: Dan Wellman
Rating: starstarstarstarstar / 107
June 30, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Virtual hosts are an integral part of the Apache HTTP server; after all they have an entire section in the httpd.conf file devoted exclusively to them. But what are they and what can they be use for?

In Internet terms, your web server is the host that serves the web pages that make up your site. Your server and the web browsers that are used to access your site interact in what is known as the host/client relationship.  If your server hosts just one site, it would be known as a dedicated server, but these are usually only necessary for running large sites with high traffic. 

Virtual hosts are separate hosts that are run from the same server as a main host, or site. This means therefore that one server can host several separate web sites simultaneously, each accessed via separate DNS names.  Visitors to your site will be unable to distinguish between virtual or dedicated sites.  The main difference between hosts and virtual hosts is that hosts have unique IP addresses and virtual hosts do not necessarily have individual IP addresses. There are in fact two types of virtual host; IP based and non-IP or name based.  IP based, as the name states do not share an IP address, non-IP based do. IP based virtual hosts are useful for when you want to manage more than one site on the same server so that all hosts inherit the characteristics defined by your main host, but for some reason, such as when using SSL for example, a unique IP address is necessary.

The fact that virtual hosts are not required to have unique IP addresses is largely what brought them about in the first place; because of the limitations of IPv4 (Internet Protocol version 4) and the explosive growth of the Internet, something was required to solve the problem of the rapidly dwindling supply of available unique IP addresses. Thus, server software began to incorporate support for non-IP based virtual hosts. Something to make note of at this point is that HTTP1.1 was also implemented with support for virtual hosts and there are still some browsers out there that donít support HTTP1.1, so therefore Apache has to handle requests from older browsers differently. Instead of receiving hostname as part of the HTTP header and opening the correct homepage in that way, it has to serve a list of available hosts. This situation will probably only arise very infrequently however, as even browsers that only support HTTP1.0 will usually have an extension to add the hostname to the HTTP header.

Virtual hosts are not the only solution to the problem of IPv4 limitations, as a point of interest, IPv6, the latest Internet Protocol incarnation, is already being used by some servers and browsers.  This version is based on a 128bit IP address format instead of the old 32bit format used by IPv4, which increases the number of unique IP addresses exponentially.  



 
 
>>> More Apache Articles          >>> More By Dan Wellman
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

APACHE ARTICLES

- Apache Unveils Cassandra 1.2
- Apache on ARM Chips? Dell and Calxeda Help M...
- The Down Side of Open Source Software
- VMware Unveils Serengeti for Apache Hadoop
- SAP Takes Steps to Improve Hadoop Integration
- Looking to Hone Apache Hadoop Skills?
- How to Install Joomla on WAMPP
- Working with XAMPP and Wordpress
- GUI Available for Apache Camel
- Reduce Server Load for Apache and PHP Websit...
- Creating a VAMP (Vista, Apache, MySQL, PHP) ...
- Putting Apache in Jail
- Containing Intrusions in Apache
- Server Limits for Apache Security
- Setting Permissions in Apache

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: