0
任何方式来通过IP解决的主机名来拒绝访问我们的网站?按主机名禁止IP?
例如: 109.163.233.200解析为wau.torservers.net,我们不希望任何人与解析为此主机名访问我们的网站。
任何帮助表示赞赏。
谢谢!
任何方式来通过IP解决的主机名来拒绝访问我们的网站?按主机名禁止IP?
例如: 109.163.233.200解析为wau.torservers.net,我们不希望任何人与解析为此主机名访问我们的网站。
任何帮助表示赞赏。
谢谢!
除非必须使用.htaccess
(我不知道它是否支持您想要的),如标签可能指示的那样,并且如果您在(非Windows)服务器盒上具有root用户访问权限,则您可以将主机名添加到/etc/hosts.deny
。让我引用它,这里Debian的,因为它是自我记录:
$ cat /etc/hosts.deny
# /etc/hosts.deny: list of hosts that are _not_ allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: some.host.name, .some.domain
# ALL EXCEPT in.fingerd: other.host.name, .other.domain
#
# If you're going to protect the portmapper use the name "portmap" for the
# daemon name. Remember that you can only use the keyword "ALL" and IP
# addresses (NOT host or domain names) for the portmapper, as well as for
# rpc.mountd (the NFS mount daemon). See portmap(8) and rpc.mountd(8)
# for further information.
#
# The PARANOID wildcard matches any host whose name does not match its
# address.
#
# You may wish to enable this to ensure any programs that don't
# validate looked up hostnames still leave understandable logs. In past
# versions of Debian this has been the default.
# ALL: PARANOID
如需更多信息,请参阅hosts.deny man page
不必做每每个请求反向DNS查询将非常昂贵。 – ryudice
什么*非常昂贵*可以这样做? – Jasonw
我发现这个:http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html - 你的意思是资源昂贵? – user1446650