We-Host.com Main Web Site
Web Development
Support

Multiple Domains on Virtual Servers
Server Settings

Virtual Hosting Setup

Modifying your httpd.conf file
To enable this feature on a Virtual Server you will need to modify your httpd.conf file. For each domain that you would like hosted on a Virtual Server, open up your httpd.conf file (in the ~/www/conf directory) and add the following at the end of the file:

    # point businessweb.com to subdirectory businessweb
    <Host www.businessweb.com businessweb.com>
    ServerName www.businessweb.com
    ServerAdmin webmaster@businessweb.com
    DocumentRoot /usr/local/etc/httpd/htdocs/businessweb
    </Host>

or, if you have installed Microsoft FrontPage 98 use "VirtualHost" instead of "Host" (as shown below):

    # point businessweb.com to subdirectory businessweb
    <VirtualHost www.businessweb.com businessweb.com>
    ServerName www.businessweb.com
    ServerAdmin webmaster@businessweb.com
    DocumentRoot /usr/local/etc/httpd/htdocs/businessweb
    </VirtualHost>

Of course, you would substitute your domain name and subdirectory in the place of the "businessweb.com" and "businessweb" occurrences.


 

Advanced Virtual Hosting Configurations

You may also want to visit the below resources for more detailed information:

For example, we can include the definition of a "Not Found Document" (ErrorDocument 404) in the "businessweb.com" Host definition.

    # point businessweb.com to subdirectory businessweb
    <Host businessweb.com>
    ServerName www.businessweb.com
    ServerAdmin businessweb@businessweb.com
    DocumentRoot /usr/local/etc/httpd/htdocs/businessweb
    ErrorDocument 404 /errors/index.html
    </Host>

or, if you have installed Microsoft FrontPage 98 use "VirtualHost" instead of "Host" (as shown below):

    # point businessweb.com to subdirectory businessweb
    <VirtualHost businessweb.com>
    ServerName www.businessweb.com
    ServerAdmin businessweb@businessweb.com
    DocumentRoot /usr/local/etc/httpd/htdocs/businessweb
    ErrorDocument 404 /errors/index.html
    </VirtualHost>

Note the file location is specified with respect to the DocumentRoot.... so the actual file location of the "notfound.html" is at:

    /usr/home/yourserver/usr/local/etc/httpd/businessweb/errors/

Another great feature is the ability to create separate log files for your Virtual hosts. In the host directives of your httpd.conf file, add lines to define your new log files like this:

    TransferLog logs/localhost_access_log

So the complete example would look like:

    # point businessweb.com to subdirectory businessweb
    <Host www.businessweb.com businessweb.com>
    ServerName www.businessweb.com
    ServerAdmin businessweb@businessweb.com
    DocumentRoot /usr/local/etc/httpd/htdocs/businessweb
    TransferLog logs/businessweb_access
    ErrorLog logs/businessweb_error
    AgentLog logs/businessweb_agent
    RefererLog logs/businessweb_referer
    <SRMOptions>
    ErrorDocument 404 /errors/notfound.html
    </SRMOptions>
    </Host>

or, if you have installed Microsoft FrontPage 98 use "VirtualHost" instead of "Host" (as shown below):

    # point businessweb.com to subdirectory businessweb
    <VirtualHost www.businessweb.com businessweb.com>
    ServerName www.businessweb.com
    ServerAdmin businessweb@businessweb.com
    DocumentRoot /usr/local/etc/httpd/htdocs/businessweb
    TransferLog logs/businessweb_access
    ErrorLog logs/businessweb_error
    AgentLog logs/businessweb_agent
    RefererLog logs/businessweb_referer
    </VirtualHost>

This will allow you to isolate the logs for a specific Virtual Host rather than having them all lumped into the master log files.

Enhancements on Apache 1.2.6+
All domain entries may be entered using the <VirtualHost... command as opposed to <Host.... if your virtual server was activated after January 1999. Virtual Servers activated previous to this time may contain the older version of httpd.conf files that requires separate entries.

[top]

Contents Copyright 1997-2003  We-Host Web Hosting. See our copyright page for additional copyright and disclaimer information.

Last Updated: 11 June, 2000  · Email support web site errors to webmaster@we-host.com

We-Host Web Hosting