Wildcard Apache2 Sub Domains

Sub domains in Apache…

Here’s the apache config used for this site.

This tells apache to serve up all sub domains of dtbaker.com.au from the same /var/www/dtbaker directory

<VirtualHost *>
ServerName dtbaker.com.au
ServerAdmin dtbaker@email.com
ServerAlias *.dtbaker.com.au

DocumentRoot /var/www/dtbaker/

<Directory />
</Directory>

<Directory /var/www/dtbaker>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

</VirtualHost>

Leave a Reply

Your email address will not be published. Required fields are marked *