Apache
  Home arrow Apache arrow Configuring and Using Virtual Hosts in...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
APACHE

Configuring and Using Virtual Hosts in Apache
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 94
    2004-06-30

    Table of Contents:
  • Configuring and Using Virtual Hosts in Apache
  • Edit the Main Configuration File
  • Virtual Host
  • Find File System Called Hosts

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Speeding Shipping, Improving Compliance – Read the ScanCode Systems Case Study

    Configuring and Using Virtual Hosts in Apache
    (Page 1 of 4 )

    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.

    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


     

       

    APACHE ARTICLES

    - Putting Apache in Jail
    - Containing Intrusions in Apache
    - Server Limits for Apache Security
    - Setting Permissions in Apache
    - Installing Apache
    - Apache Installation and Configuration
    - Apache Tapestry and Custom Components: DateI...
    - Tapestry and AJAX: Autocompleter and InlineE...
    - PropertySelection and IPropertySelectionMode...
    - The DatePicker and Shell Components of Apach...
    - Apache Tapestry: ASO and More Components
    - Apache Tapestry and DirectLink, IoC and DI
    - Making a CelebrityCollector with Apache Tape...
    - Apache Tapestry and Listener Methods, Condit...
    - The Properties of Tapestry Pages

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway