You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Edward Ruggeri <sm...@crawblog.com> on 2009/09/26 19:05:07 UTC

Re: [users@httpd] Using VirtualHosts, do I need to specify "main" ServerName?

On Sat, Sep 26, 2009 at 12:49 PM, Stephen <st...@rogers.com> wrote:
> Edward Ruggeri wrote:
>>
>> (Of course, my system hostname (in /etc/hostname) is not fully qualified.)
> Your hostname, should have an entry in /etc/hosts
>
> 127.0.0.1 hostname
>
> Then Apache is happy and you are fine.

Thanks, but, it isn't happy until you fully qualify the domain name,
for instance, in /etc/hosts: 127.0.0.1 hostname.local hostname.
(Oddly, it doesn't insist on a FQDN if you specify ServerName)

In fact, I'm not so much worried about why Apache might want a FQDN
(to generate redirects, etc).  What I'm worried about is the statement
that Apache is going to get the IP address associated with the FQDN
(either from lookup in /etc/hosts or through DNS*).  What could that
possibly be used for?  Is that really what Apache does?

-- Ned Ruggeri

*Not reverse DNS, as I mistakenly wrote!

---------------------------------------------------------------------
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] Using VirtualHosts, do I need to specify "main" ServerName?

Posted by Norman Peelman <np...@cfl.rr.com>.
Edward Ruggeri wrote:
> On Sat, Sep 26, 2009 at 6:21 PM, Norman Peelman <np...@cfl.rr.com> wrote:
>   
>> Apache (linux/windows) will check the 'hosts' file first and then do DNS
>> lookups when no matches are found. I don't understand why your not worried
>> about why it needs it but you are worried about how it gets it. The main
>> server needs a name just like the vhosts, for the very reasons you yourself
>> gave.
>>     
>
> Excuse me: DNS associates IP's to names.  I understand that apache
> wants a host name.  But it won't find it through DNS.
>
> When I say I'm not worried about Apache finding a host name, it's
> because I know how to configure hostname and /etc/hosts (or just
> specify ServerName) so that Apache gets the correct hostname.  I can
> easily make the error go away.  What I'm worried about is the
> documentation claim that Apache needs to do a DNS lookup to find an IP
> address.  I don't understand what this IP could possibly be used for
> (though the documentation seems to think that's obvious?).
>
> So, let me restate my two questions:
> (1) Does Apache really ever try to do a lookup (either in /etc/hosts
> or DNS) for an IP address, as seems to be implied by the
> documentation?
> (2) Why would it?  That is, what would the IP address be used for.
>
> I also reference the documentation again, below:
>
> "The addition of name-based virtual host support in Apache 1.1
> requires Apache to know the IP address(es) of the host that httpd is
> running on. To get this address it uses either the global ServerName
> (if present) or calls the C function gethostname (which should return
> the same as typing "hostname" at the command prompt). Then it performs
> a DNS lookup on this address. At present there is no way to avoid this
> lookup."
>
>
>
>   

Ok, so http traffic is controlled by ip addresses not domain names. I 
don't believe it needs to do a DNS lookup if the hosts file contains 
what it's looking for.


-- 
Norman Registered Linux user #461062
-Have you been to www.apache.org yet?-

---------------------------------------------------------------------
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] Using VirtualHosts, do I need to specify "main" ServerName?

Posted by Edward Ruggeri <sm...@crawblog.com>.
On Sat, Sep 26, 2009 at 6:21 PM, Norman Peelman <np...@cfl.rr.com> wrote:
> Apache (linux/windows) will check the 'hosts' file first and then do DNS
> lookups when no matches are found. I don't understand why your not worried
> about why it needs it but you are worried about how it gets it. The main
> server needs a name just like the vhosts, for the very reasons you yourself
> gave.

Excuse me: DNS associates IP's to names.  I understand that apache
wants a host name.  But it won't find it through DNS.

When I say I'm not worried about Apache finding a host name, it's
because I know how to configure hostname and /etc/hosts (or just
specify ServerName) so that Apache gets the correct hostname.  I can
easily make the error go away.  What I'm worried about is the
documentation claim that Apache needs to do a DNS lookup to find an IP
address.  I don't understand what this IP could possibly be used for
(though the documentation seems to think that's obvious?).

So, let me restate my two questions:
(1) Does Apache really ever try to do a lookup (either in /etc/hosts
or DNS) for an IP address, as seems to be implied by the
documentation?
(2) Why would it?  That is, what would the IP address be used for.

I also reference the documentation again, below:

"The addition of name-based virtual host support in Apache 1.1
requires Apache to know the IP address(es) of the host that httpd is
running on. To get this address it uses either the global ServerName
(if present) or calls the C function gethostname (which should return
the same as typing "hostname" at the command prompt). Then it performs
a DNS lookup on this address. At present there is no way to avoid this
lookup."


-- Ned Ruggeri

---------------------------------------------------------------------
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] Using VirtualHosts, do I need to specify "main" ServerName?

Posted by Norman Peelman <np...@cfl.rr.com>.
Edward Ruggeri wrote:
> On Sat, Sep 26, 2009 at 12:49 PM, Stephen <st...@rogers.com> wrote:
>   
>> Edward Ruggeri wrote:
>>     
>>> (Of course, my system hostname (in /etc/hostname) is not fully qualified.)
>>>       
>> Your hostname, should have an entry in /etc/hosts
>>
>> 127.0.0.1 hostname
>>
>> Then Apache is happy and you are fine.
>>     
>
> Thanks, but, it isn't happy until you fully qualify the domain name,
> for instance, in /etc/hosts: 127.0.0.1 hostname.local hostname.
> (Oddly, it doesn't insist on a FQDN if you specify ServerName)
>
> In fact, I'm not so much worried about why Apache might want a FQDN
> (to generate redirects, etc).  What I'm worried about is the statement
> that Apache is going to get the IP address associated with the FQDN
> (either from lookup in /etc/hosts or through DNS*).  What could that
> possibly be used for?  Is that really what Apache does?
>
> -- Ned Ruggeri
>
> *Not reverse DNS, as I mistakenly wrote!
>
> ---------------------------------------------------------------------
>   

Apache (linux/windows) will check the 'hosts' file first and then do DNS 
lookups when no matches are found. I don't understand why your not 
worried about why it needs it but you are worried about how it gets it. 
The main server needs a name just like the vhosts, for the very reasons 
you yourself gave.

-- 
Norman Registered Linux user #461062 -Have you been to www.apache.org yet?-

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