Manually Configuring Virtual Subhosts

For each Virtual Subhost you configure on your Virtual Server you will need to create a new directory for the subhosted domain files and make an addition your web server configuration file. It is probably best to create the new subhosted domain directory in your Virtual Server ~/www/vhosts directory, like this:

  • (if the vhosts directory does not already exist, do this first)
    % mkdir ~/usr/local/etc/httpd/vhosts

    (then make the subhosted domain name directory)
    % mkdir ~/usr/local/etc/httpd/vhosts/yourname

NOTE: It was previously documented that the subhosted domain directory be created in the ~/www/htdocs directory (not the ~/www/vhosts directory). To insure compatibility with the lastest version of Microsoft FrontPage, we recommend that the subhosted domain directories not exist inside the ~/www/htdocs directory.

If you decide to use the vhosts directory for your subhosts (as recommended) and your Virtual Server was setup prior to July 1, 1999, it is likely that a <Directory> definition will need to be created at the bottom of your ~/www/conf/httpd.conf file (or at the bottom of your ~/www/conf/access.conf file if you have three separate config files). The <Directory> definition you may need to add is as follows:

<Directory /usr/local/etc/httpd/vhosts>
Options Indexes FollowSymLinks Includes
AllowOverride All
order allow,deny
allow from all
</Directory>

After you have created the directory where the content for the subhosted domain name will reside, open up your httpd.conf file (in your ~/www/conf directory) and add the following lines in the <VirtualHost> section of the httpd.conf configuration file.

NOTE: Make sure you add the VirtualHost definitions in the correct place in your httpd.conf file. If the VirtualHost definitions are not placed in the VirtualHost section of the httpd.conf file, then you may encounter some compatibility problems with the latest version of Microsoft FrontPage. If your Virtual Server was setup with a single config file, the VirtualHost section of the httpd.conf file is found in the middle of the file. If your Virtual Server was setup with triple config files (httpd.conf, srm.conf, and access.conf), then the VirtualHost section is found at the bottom of the httpd.conf file.
  • (add the following lines to your httpd.conf)
    # point www.yourname.org and yourname.org to subdirectory yourname
    <VirtualHost www.yourname
    .org yourname.org>
    ServerName www.yourname
    .org
    ServerAdmin webmaster@yourname
    .org
    DocumentRoot /usr/local/etc/httpd/vhosts/yourname
    </VirtualHost>
NOTE: It is important that the first domain name you list in the <VirtualHost...> directive matches the domain name you specify as the ServerName. This will insure that problems do not occur if you install the latest version of Microsoft FrontPage at a later date.

You will need to 1) substitute the subhosted domain name in the place of the yourname.org occurrences in the example above; and 2) replace the name of the subdirectory you choose for the subhosted domain name in the place of yourname above. After you have completed these simple steps, web requests for the subhosted domain name will be directed to the directory you designated and web content will be served from that directory.