"Bergset" <sabergset@gmail.com> writes:
>The problem is that the Apache server can't resolve any of my name
>based virtualhosts during startup. The strange thing is that doing DNS
>lookup manually with dig, nslookup or whatever is no problem at all.
>Both normal and reverse lookup produces correct results.
>The first nameserver statement in /etc/resolv.conf points to the test
>nameserver. I assume Apache's resolve method uses this information.
First have a look at the file /etc/nsswitch.conf, this tells you the
order of the resources used to resolve a hostname. My, and most,
nsswitch.conf contain:
hosts: files dns
This tells first any normal program (which uses a library to resolve
hostnames) will try to resolve using the contents of /etc/hosts, if
this fails, /etc/resolv.conf is used to locate dns nameservers.
The programs "host" and "dig" look only at /etc/resolv.conf.
It is best not to put things in /etc/hosts, unless you absolutely need
to (to overcome network outages).
I thing Apache will not warn if it can't resolve a hostname set in the
ServerName of a VirtualHost section. But it needs to resolve it at
startup time, otherwise the section will be ignored during runtime (without
you finding out why). For ServerAlias though, it will never try to resolve
the names (hehehe, I'm making use of that in my project which has a
nameserver inside of Apache, answering queries to ITself).
>Putting the virtualhost domains in the hosts file produces no errors,
>so it's safe to assume that this is a network DNS issue.
>My bind setup is using wildcard as follows:
>@ IN A 192.168.1.1
>* IN CNAME @
>The zone is "testdomain.com" and the virtualhost domains are mostly
>subdomain of "testdomain.com".
>I know CNAME wildcards is somewhat dubious, but this isn't an issue
>that would cause the Apache resolve problem. A setup without wildcard
>produce the same error.
>The DNS and Apache servers are on separate hosts at 192.168.1.0/24.
>Does anyone have an idea about the cause of this Apache resolve
>problem?
I don't understand your complete setup, you might want post a more
complete bind configuration file and the VirtualHost snippet of the
Apache server you have a problem with (or mail them to me).
If you do a "host name.testdomain.com" on the server running the Apache,
having cleared its /etc/hosts, does it resolve to an IP number?
If so Apache should run, and we need a little more info on the config
files.
\Berry
www.globule.org.