0

有什么方法可以拒绝通过 IP 解析的主机名访问我们的网站?

例如: 109.163.233.200 解析为 wau.torservers.net ,我们不希望任何人使用解析为该主机名的主机名访问我们的站点。

任何帮助表示赞赏。

谢谢!

4

1 回答 1

0

除非您必须这样做.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 手册页

于 2012-10-28T23:55:09.947 回答