DNS and Apache NameVirtualHost - can't get it right!

janl at linpro.no janl at linpro.no
Wed Feb 16 12:07:20 UTC 2000


Joakim Schramm <joakim at humanet.se> tastet:
> I'm trying to bring some of my now IP based virtual hosts in Apache into
> Name hosted, all under 1 IP - but I can't figure out who the DNS
> records/-zone files should be set up.
> 
> Tried to move an A rec for each into the zone file that now have the IP
> that should be used, but just get log mess like:
> Feb 13 12:47:19 ns named[10776]: domain1.nu.zone:21: data
> "www.domain2.nu" outside zone "domain1.nu" (ignored)

Yes, that is a wrong way.

> Also tried in each zonefile to change the IP to the one I want to use
> and the same in the zonefile with the PTR entried. No errors when
> restart Named but browesing to the domain just bring to the main http
> docs map. I'm pretty sure this is a DNS misconfig rather then an Apache
> config so thats why I post here.

This is the right way.  I'm pretty sure you misconfigured your apache
slightly.

- You need a NameVirtualHost line in httpd.conf.  It must name a
  hostname which the machine answers to.  If the hostname is
  mail.linpro.no then a network interface on your machine should
  have the address 195.0.166.2

- Then you do something like this, also in httpd.conf:

<VirtualHost mail.linpro.no>
ServerAdmin webmaster at foo.bar
DocumentRoot /home/kunder/foo.bar/www
ServerName www.foo.bar
ErrorLog logs/foo.bar-error_log
TransferLog logs/foo.bar-access_log
</VirtualHost>

  Please note that the VirtualHost line names the same host as
  NameVirtualHost and that the ServerName gives the real name of
  the ip-less virtual server.

Nicolai





More information about the bind-users mailing list