Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The apache documentation states a DNS lookup will be performed when the Allow from (or Deny from) clause contains a domain name (e.g Allow from myserver.com). What if the domain name and IP is listed /etc/hosts?

Thanks

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Apache use nsswitch. If IP address in /etc/hosts then use /etc/hosts information.

Comment "10.0.2.15 localhost" in /etc/hosts:

curl 10.0.2.15
16:48:41.505697 IP 10.0.2.15.43281 > 10.0.2.2.53: 11646+ PTR? 15.2.0.10.in-addr.arpa. (40)
16:48:41.506336 IP 10.0.2.2.53 > 10.0.2.15.43281: 11646 NXDomain* 0/1/0 (99)

Uncomment "10.0.2.15 localhost" in /etc/hosts:

curl 10.0.2.15

but performance still decreases:

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
  0.88    0.028002          37       752           getsockname
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.