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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux