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 08:49:52 UTC

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

Hello everyone,

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?

For example:

foo.myhost.mydomain --> /var/www/foo/
bar.myhost.mydomain --> /var/www/bar/
bar.myhost.mydomain/path/ --> /var/www/bar/path/

I know I can do that with multiple VirtualHost configuration elements, 
but I'd like to add new subdomains just by creating a directory.

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


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

Posted by Joshua Kogut <jm...@gmail.com>.
I have always used wildcards (see mass-virtual hosting in the apache docs).
Never failed.

On 11/3/05, Rich Bowen <rb...@rcbowen.com> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Andreas Schildbach wrote:
> > Hello everyone,
> >
> > 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?
> >
> > For example:
> >
> > foo.myhost.mydomain --> /var/www/foo/
> > bar.myhost.mydomain --> /var/www/bar/
> > bar.myhost.mydomain/path/ --> /var/www/bar/path/
> >
> > I know I can do that with multiple VirtualHost configuration elements,
> > but I'd like to add new subdomains just by creating a directory.
>
> This is what mod_vhost_alias does.
> VirtualDocumentRoot /var/www/%1
>
> See http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html
>
> - --
> Rich Bowen
> rbowen@rcbowen.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (Darwin)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFDaihvXP03+sx4yJMRAuoLAJ9P+sZkBUGcoQ2fMuHQYGG4EnowKACfVob3
> +Hvo1+rmbIpaUQR0QW5j2/M=
> =sa5p
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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
>
>


--
|| jmkogut ||
email: jmkogut@gmail.com
|| Networking: Where all your problems are category 5. ||

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

Posted by Rich Bowen <rb...@rcbowen.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Schildbach wrote:
> Hello everyone,
> 
> 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?
> 
> For example:
> 
> foo.myhost.mydomain --> /var/www/foo/
> bar.myhost.mydomain --> /var/www/bar/
> bar.myhost.mydomain/path/ --> /var/www/bar/path/
> 
> I know I can do that with multiple VirtualHost configuration elements,
> but I'd like to add new subdomains just by creating a directory.

This is what mod_vhost_alias does.
VirtualDocumentRoot /var/www/%1

See http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html

- --
Rich Bowen
rbowen@rcbowen.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDaihvXP03+sx4yJMRAuoLAJ9P+sZkBUGcoQ2fMuHQYGG4EnowKACfVob3
+Hvo1+rmbIpaUQR0QW5j2/M=
=sa5p
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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