Apache
  Home arrow Apache arrow Page 4 - Configuring and Using Virtual Hosts in Apache
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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: starstarstarstarstar / 101
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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.



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

       

    APACHE ARTICLES

    - Creating a VAMP (Vista, Apache, MySQL, PHP) ...
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT