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 dmcbeta.com. So foo.dmcbeta.com 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"
        ServerName dev.digitaltrike.com
        ServerAlias *.digitaltrike.com
        ServerAlias *.dmcbeta.com
        ServerAlias dmcbeta.com
        ServerAdmin [email protected]
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
</VirtualHost>

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
</Directory>

Virtual Hosts

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