apache文档声明当Allow from(或Deny from)子句包含一个域名(例如Allow from myserver.com)时将执行DNS查询。 如果域名和IP列在/ etc / hosts?
谢谢
Apache使用nsswitch。 如果/ etc / hosts中的IP地址则使用/ etc / hosts信息。
在/ etc / hosts中注释“10.0.2.15 localhost”:
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)
在/ etc / hosts中取消注释“10.0.2.15 localhost”:
curl 10.0.2.15
但性能仍然下降:
% time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 0.88 0.028002 37 752 getsockname