Perttu Laine wrote:

I have domain configured so *.domain.tld are A record to same IP. Now
I have apache vhosts so www.domain.tld and domain.tld goes to apache
data dir and webmail.domain.tld goes to webmail data dir.
Problem is howto forward those all others to certain directory. s it
possible to make *.domain.tld vhost to go in one dir. so anything else
than domain.tld, www.domain.tld and webmail.domain.tld goes to like 
/www-data/somedir.

One solution would be make that somedir to default root, but cannot
use it 'cause I have other domains on same apache taht I have to
handle differently.

Someone known what I mean? Or even how to do this? :)



Yes. It is quite simple.

Check out the following example, this is currently how I am setup.

I use a straight Bind directive:

BindAddress *

and then, we add the name directive:

NameVirtualHost *

Then, we can add as many hostnames (provided they have a domain record. They MUST have a valid domain record. Either an A or an Alias)

<VirtualHost *>
   ServerName www.domain1.com
   DocumentRoot /path/to/first/dir
   </VirtualHost>

   <VirtualHost *>
   ServerName www.domain2.net
   DocumentRoot /a/different/pathname
   </VirtualHost>

Now, we get freaky.

   <VirtualHost *>
   ServerName duo.domain2.net
   DocumentRoot /path/to/my/home/dir/duo
   </VirtualHost>

   <VirtualHost *>
   ServerName someonelse.domain1.com
   DocumentRoot /path/to/entirely/different/place
   </VirtualHost>

Now, in the above example, my main server Document Root is the same as my Virtual host for www.domain2.net. As long as you have legal hostnames, you can define them as a Virtual Host. Name based Virtual hosting is well described in the apache manual. As it relies mostly on the browser telling the server what name its looking for.

Try it and test. Make a copy of your httpd.conf and play a bit. =)

--
Duo.

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to