[lug] Re: Virtual Hosting

Nate Duehr nate at natetech.com
Wed Mar 14 10:41:06 MST 2001

Well, you *could* do that.

I guess what I'm saying is that BIND doesn't really do anything special 
for virtual hosting.

Just for example, if you have your apache server set up to host 
www.domain1.com and www.domain2.com, you just set up those two domains 
in BIND in the normal fashion, but you point the IP addresses in the A 
records to the same IP address...

So just for example sake, you'd have the following in your named.conf file:

zone domain1.com {
	type master;
	file "domain1.zonefile.whereveryouwantit";

zone domain2.com {
	type master;
	file "domain2.zonefile.whereveryouwantit";

In those files you'd have normal BIND zone files that would look like:

[snipped SOA record]

$ORIGIN domain1.com

	IN A	111.222.333.444 ; IP of virtual host1
		IN MX 10  mail.domain1.com.
mail 		IN A	222.333.444.555 ; IP of mail server
	IN A	111.222.333.444 ; IP of virtual host1
And in the other file:

$ORIGIN domain2.com

	IN A	111.222.333.555 ; IP of virtual host2
		IN MX 10	mail.domain2.com.
	IN A 	222.333.444.555 ; IP of mail server
	IN A	111.222.333.555 ; IP of virutal host2

That's if you're running separate IP's on the virtual hosts.  (Which is 
not recommended by ARIN.  The only reason you ever need to do this 
nowadays is if the sites are SSL-enabled because SSL certificates are 
tied to the IP address and name of the server they came from.)

If you want to save some time and all the servers use the same IP, leave 
the $ORIGIN statement out of the zonefile and make a master file and 
symlink your "real" domain names to that master.

That's one way to do it anyway, there's a whole lot more.

Are we on the same page?  BIND doesn't care if you're doing virtual 
hosting or not.


SoloCDM wrote:

> Nate Duehr stated the following:
>> In BIND you just set up zone files for your different DNS zones and point them
>> all at the same IP address if you're doing Virtual Hosting.  I'm not sure what
>> your question is.  (?)  There's no special configuration for DNS when doing
>> virtual hosting other than the oddball *.domainname.com syntax if
>> your "machine" names change in your code that publishes pages...
>> Quoting SoloCDM <deedsmis at aculink.net>:
>>> I know how to do Apache, Sendmail, ..., but where is the documentation
>>> for Virtual Hosting for DNS & BIND to create the file that holds all
>>> the virtual hosts (aliases) directed back at the server.  If any
>>> additional information, links, pages (possibly DNS & BIND) is
>>> necessary, please be sure to include them.  Thanks!
> It was my understanding that all the virtual hosts are listed in one
> file and that file is pointed back to the server IP.  Maybe it
> involves the $INCLUDE directive?
> Note: When you reply to this message, please include the mailing
>       list/newsgroup address in Cc: and my email address in To:.
> *********************************************************************
> Signed,
> SoloCDM

More information about the LUG mailing list