Apache disable DNS lookups

apache-2.2domain-name-system

I'm using Debian 4.3.2-1 and Apache 2 on my production server. Watching the logs, I noticed Apache is resolving client's hostnames even with HostnameLookups Off in apache2.conf. I want to avoid these lookups so I'm guessing Apache is making this DNS query because I have mod_authz_host enabled. When I try to unlink this module, I get several modules complaining because they use the Order directive.

How is the clean way to go? Should I comment all Order directives like

Order allow,deny
Deny from all

Is this the only way to stop Apache from making DNS requests? I would like to deny access to .htaccess files and some rules like that.

Best Answer

mod_authz_host will only perform DNS lookups, if you actually use domain names in any Allow/Deny directive (and then this will happen irrespective of the HostnameLookups setting). So if you don't want those DNS lookups happening, get rid of the domain-name based authorisation config, if that's at all possible.