Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 按主机名禁止IP?_.htaccess_Http_Ip_Hostname - Fatal编程技术网

.htaccess 按主机名禁止IP?

.htaccess 按主机名禁止IP?,.htaccess,http,ip,hostname,.htaccess,Http,Ip,Hostname,有没有办法通过IP解析的主机名拒绝访问我们的站点 例如: 109.163.233.200解析为wau.torservers.net,我们不希望任何人使用解析为此的主机名访问我们的站点 感谢您的帮助 谢谢大家! 除非您必须使用.htaccess(我不知道它是否支持您所需的功能),如标签所示,并且如果您在(非Windows)服务器框上具有root访问权限,您可以将主机名添加到/etc/hosts.deny。让我在Debian上引用它,因为它是自我记录的: $ cat /etc/hosts.deny

有没有办法通过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

有关更多信息,请参见

必须对每个请求执行反向dns查找将非常昂贵。这会非常昂贵吗?我发现:-您的意思是资源昂贵?