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