This is an old revision of the document!

Apache Virtual Hosts

Automatic Virtual Hosts

Apache is setup so that any directory created in the /usr/tahiti/www directory will automatically work as a sub-domain under So would access /usr/tahiti/www/foo

The configuration for setting up the dynamic vhosts is in /etc/apache2/vhosts.d/99_magic_vhosts.conf

<VirtualHost *:80>
        VirtualDocumentRoot "/home/dmedia/public_html/%1"
        ServerAlias *
        ServerAlias *
        ServerAdmin [email protected]
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript

If you want to set permissions on a specific directory, the Directory initiative will not accept '%1', although it can use '*'.

Using this configuration, permission to the directory will be denied by default, per Apache's default setup. Create a Directory group to prefix the virtual hosts to allow access:

<Directory "/home/dmedia/public_html/*">
        Order allow,deny
        Allow from all

Virtual Hosts

Other virtual hosts have configuration files in /etc/apache2/vhosts.d There is one configuration file for each virtual host.