Home arrow BSD Applications arrow Apache WebServer arrow Apache Virtual Host
Apache Vitual Host PDF
Thursday, 08 December 2005
Apache allows you to run multiple web sites on just one IP address, by setting up multiples virtual hosts.

To setup a virtual host on Apache web server you must add the following to httpd.conf:

httpd.conf
------------------------------------------------------------------------------------------------------

NameVirtualHost *

<VirtualHost *>
    ServerAdmin root@example
    DocumentRoot /home/www/htdocs
    ServerName www.example.com
    ServerAlias example.com
    ErrorLog /home/www/logs/example.com_error_log
    CustomLog /home/www/logs/example.com_access_log common

</VirtualHost>

------------------------------------------------------------------------------------------------------
end httpd.conf

The explanations for the above are:
    ServerAdmin - the mail for the person responsable for the website
    DocumentRoot - the path on the server where the documents for the site are located
    ServerName - the domain/subdomain name for which this server will respond
    ServerAlias - if you want your server to respond for other aliases, for example for domain name without a leading www.
    ErrorLog, CustomLog - the paths to the logs

Repeat last section ( between  VirtualHost tag) for all the domains and subdomains you want to setup.

Last Updated ( Thursday, 08 December 2005 )
 

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?