屏蔽IIS中服务器IP的访问网站

问题描述 投票:0回答:1

假设我的服务器ip为184.198.74.73,域名为testing.com,主机为IIS 10。如何禁止用户访问该ip地址的网站?

问题描述:以google.com为例。

以google.com为例。我ping google ip可以得到它的ip地址.但是我用ip地址即使使用Postman也无法访问它.这该怎么做呢?

iis web-config hosting
1个回答
0
投票

首先在iis中设置绑定域名的网站即可。如下图所示。

enter image description here

你可以设置规则为不允许主机头到IP地址。

<rule name="RequestBlockingRule1" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="192.168.2.50" />
                </conditions>
                <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
            </rule>

然后你可以设置iis的IP和域名限制,如果你不想让特定的IP地址或IP地址范围访问你的网站。

https:/docs.microsoft.comen-usiisget-startedwhats-new-in-iis-8iis-80-dynamic-ip-address-restrictions。

© www.soinside.com 2019 - 2024. All rights reserved.