Using vaddhost to Automatically Configure Virtual Subhosts

For each Virtual Subhost you would like to add on Virtual Server, you will need to add what is known as a "<VirtualHost>" entry in your main web service configuration file (httpd.conf). You can manually configure Virtual Subhosts on your Virtual Server or you can use the utility "vaddhost".

The vaddhost utility functions similarly to the "vadduser" utility (which adds new E-mail/FTP accounts to your Virtual Server). The vaddhost utility will ask you several questions about the configuration of your Virtual Subhost and provide you with default responses. As you answer each question, vaddhost will display the <VirtualHost> definition with each new piece of information. Once you have responded to all questions, vaddhost will create necessary directories and add the <VirtualHost> entry to your main web server configuration file (httpd.conf). An outline of all the vaddhost steps and an accompanying explanation is included below.

  • Launch vaddhost
    Connect to your Virtual Server using Telnet or SSH and run the vaddhost command by typing:
    % vaddhost

    Step 1: Virtual Host Name(s)
    Virtual Host Names identify which domain names will be associated with the Virtual Subhost definition that vaddhost will add to your httpd.conf file. You may specify one or more domain names with each Virtual Subhost definition. Typically, a Virtual Subhosted domain name will at the very least include the "www.domain.name" and "domain.name" Virtual Host Names.

    Step 2: Virtual Host Admin E-mail Address
    The Host Admin E-mail Address identifies the e-mail address of the person responsible for the web site of the subhosted account. If the e-mail address you specify will be a E-mail account on the Virtual Server, you will need to use the
    vadduser program to add the e-mail account separately.

    Step 3: Virtual Host Document Root
    The Virtual Host Document Root is the directory where the web site content for the Virtual Subhost will be stored. The value of the Document Root is defined with respect to your home directory, so you need not preface your definition with "/usr/home/[your login id]". The default value for the Document Root directory is located in your "vhosts" directory. This is to insure compatibility with the latest version of Microsoft FrontPage should you decide to install Microsoft FrontPage at a later date.

    Step 4: Transfer and Error Log Files
    You can (if you choose) specify separate transfer and error log files for each Virtual Host. This is an optional feature. If you do not wish to store separate logfiles for the Virtual Subhost, the transfer and error log information will be stored in the web server's master log files. If you do wish to store separate tranfer and error log files, vaddhost will provide you with several options based on the input you provided for the Virtual Subhost Document Root.

    Step 5: cgi-bin Directory
    You can also (if you choose) configure a cgi-bin directory for your Virtual Host. This is an optional feature. The cgi-bin "ScriptAlias" directive defines where CGI scripts are stored for the Virtual Subhost.

After you have completed these steps, vaddhost will create all necessary directories and add the <VirtualHost> entry to your main web server configuration file (httpd.conf) and create a backup of your old httpd.conf file in your ~/www/conf directory. You can remove these backup files at your discretion.