You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Andreas Schildbach <an...@schildbach.de> on 2005/11/03 09:29:04 UTC

[users@httpd] Re: Subdomains just by creating a directory?

Boyle Owen wrote:

>>is it possible to configure Apache2 to serve the contents of a 
>>directory, in a way so the first level of the structure serves as the 
>>name of a subdomain?
> 
> I don't see the problem. This is exactly what apache does by default. The DocumentRoot directive maps the base URL of the site (bar.myhost.mydomain) onto a filesystem path (/var/www/bar) then any additional path information in the URL is simply appended to the DocumentRoot (bar.myhost.mydomain/path/ --> /var/www/bar/path/)
> 
> What have you tried? What went wrong? (include error-log messages)...

Both Debian and Ubuntu install a default mapping 
(/etc/apache2/mods-available/default) that looks like the following:

NameVirtualHost *
<VirtualHost *>
         DocumentRoot /var/www/
         <Directory />
		[...]
         </Directory>
         <Directory /var/www/>
		[...]
         </Directory>

         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
         <Directory "/usr/lib/cgi-bin">
		[...]
         </Directory>
</VirtualHost>

This maps as follows:

mydomain.tld --> /var/www/
mydomain.tld/foo --> /var/www/foo/
...and so on...

Which directive do I have to change in order to get the "default" 
behaviour, as you said?

Regards,

Andreas


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org