Mar
25
Dynamic VirtualHost using mod_vhost_alias
Filed Under (Web) by jc on 25-03-2008
Tagged Under : apache, dynamic virtualhost, mod_vhost_alias, virtual host, virtualhost
I was looking into a solution for a customer and mod_vhost_alias came in handy.
Lets say you want to host blogs for several people and you want to host them on the following subdomain format: blogname.crazyblogs.com. Instead of having a separate virtual host for each one, you can do something like this:
<VirtualHost 123.111.222.123:80>
UseCanonicalName Off
VirtualDocumentRoot /var/www/%0/htdocs
ServerName *.crazyblogs.com
</VirtualHost>
Now, if you go to http://blog1.crazyblogs.com, it will look for a index file inside /var/www/blog1.crazyblogs.com/htdocs.
You can find further information on:
