I want apache to automatically recognize subdomains based on the filename that I have placed in /var/www/subdomains/
I'm a complete apache noob.
P.S. I'm using Ubuntu 10.10
This can be done if you follow the instructions for Simple dynamic virtual hosts in the Apache documentation.
Follow a standard convention for your VirtualHosts, like
/var/www/www.subdomain.org/cgi-bin, and then add something like the following to your HTTP configuration.
Note how the paths below use
%0. This will be populated by the server name which is used in the contents of the
Host: header in the HTTP request. You must use
UseCanonicalName Off for this to work. Also note that if a visitors goes to 'www.example.com' 'example.com', the 'Host: ' is different, therefore '%0' is different, so you'll need symlinks or another method to tell Apache that
/var/www/example.com/ are the same thing.
# get the server name from the Host: header UseCanonicalName Off # this log format can be split per-virtual-host based on the first field LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon CustomLog logs/access_log vcommon # include the server name in the filenames used to satisfy requests VirtualDocumentRoot /var/www/%0/docs VirtualScriptAlias /var/www/%0/cgi-bin