Apache
  Home arrow Apache arrow Page 4 - 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

    Dell PowerEdge Servers

    Configuring and Using Virtual Hosts in Apache - Find File System Called Hosts
    (Page 4 of 4 )

    I have shown you only the most basic way of setting up virtual hosts; you can use almost any directive inside a <VirtualHost> container, and these directives will override or work alongside the equivalent directive in the main server configuration.

    The only limit to how many virtual hosts you can create are the limitations of the physical machine that Apache is running on. Apache uses file descriptors, integers denoting files that are open, for any log files, in addition to another twenty used by the server itself. On most UNIX platforms, the limit to the number of file descriptors in use is 64, which can be used up very quickly. Changes to the configuration of the operating system can increase this, but a more suitable solution is not using the ErrorLog or TransferLog directives within the <VirtualHost> blocks, which will make Apache write only to the main hosts log files and therefore reduce the number of log files in use. Additionally, some operating systems will need to have an extra network interface card for each IP address.   

    If you are using Apache on a Windows XP desktop PC, for testing PHP or CGI for example, you now need to find a system file called hosts, which will be under the following path: C:WINDOWSsystem32driversetc. Open the file with Notepad and you should see something like this:

    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10      x.acme.com                 # x client host
    127.0.0.1       site1 site2

    The IP Address for a local host is always 127.0.0.1. To make it work you just need to add the virtual host name to the same line as the main host name, separated by a tab-space. This is similar to mapping your server's DNS settings.

    You should now have enough information to begin creating and managing virtual hosts with Apache. There are many configurations that can be used, so experiment until you find one that matches your particular needs.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

    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