[Home] WorkersWiki a small wiki for independent developers. No login required; anyone can edit.

ApacheVirtualHosts

Name-based virtual hosts on Apache 1.3 and 2.0. Most of our client boxes are Debian woody/sarge.

NameVirtualHost? *:80
<VirtualHost? *:80>
    ServerName? www.example.com
    ServerAlias? example.com
    DocumentRoot? /var/www/example
    ErrorLog? /var/log/apache/example-error.log
    CustomLog? /var/log/apache/example-access.log combined
</VirtualHost?>

The first VirtualHost? block is the default. Put a dummy one first so a request with an unknown Host header does not land on a client site.

Things that bite:

For Apache 2 the log paths are /var/log/apache2 and the config is split into sites-available and sites-enabled with a2ensite. Debian did this and now everyone asks where httpd.conf went.


Edit text of this page | View other revisions
Last edited September 30, 2004 00:00 by DanielK (diff) | RecentSearches
Search: