Windows虚拟主机禁止指定IP访问

简介: Windows IIS 通过Rewrite 禁止IP

对于windows 虚机空间来说,服务商没有IP黑白名单的控制功能,在某些情况下,需要禁止指定IP如何解决?
这点其实通过rewrite 规则即可实现,通过给IIS 安装rewrite 模块即可使用 ,URL Rewrite 模块下载地址访问 https://www.iis.net/downloads/microsoft/url-rewrite

如何屏蔽指定IP

在自己电脑上安装IIS上,安装rewrite模块后,打开URL重写模块,选择添加规则
打开如下界面
20190618095016

选择规则模板【请求阻止】,确定后打开规则创建向导,例如要屏蔽123.4.0.139,按照下面规则设置

_

点击确定后会在指定站点下生成web.config
文件,内容如下,将下面规则
部分添加到自己的web.config文件中,如果站点下本身没有web.config文件,
将生成的web.config文件直接上传到ftp里面。

<?xml version="1.0" encoding="UTF-8"?>

<system.webServer>
    <rewrite>
        <rules>                
            <rule name="RequestBlockingRule1" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" />
                <conditions>
                    <add input="{URL}" pattern="123.4.0.139" />
                </conditions>
                <action type="AbortRequest" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

目录
相关文章
|
3月前
|
存储 负载均衡 Java
如何配置Windows主机MPIO多路径访问存储系统
Windows主机多路径(MPIO)是一种技术,用于在客户端计算机上配置多个路径到存储设备,以提高数据访问的可靠性和性能。本文以Windows2012 R2版本为例介绍如何在客户端主机和存储系统配置多路径访问。
195 13
如何配置Windows主机MPIO多路径访问存储系统
|
4月前
|
Apache 数据中心 Windows
将网站迁移到阿里云Windows系统云服务器,访问该站点提示连接被拒绝,如何处理?
将网站迁移到阿里云Windows系统云服务器,访问该站点提示连接被拒绝,如何处理?
|
4月前
|
域名解析 缓存 网络协议
Windows系统云服务器自定义域名解析导致网站无法访问怎么解决?
Windows系统云服务器自定义域名解析导致网站无法访问怎么解决?
|
4月前
|
弹性计算 关系型数据库 网络安全
阿里云国际版无法连接和访问Windows服务器中的FTP服务
阿里云国际版无法连接和访问Windows服务器中的FTP服务
|
4月前
|
应用服务中间件 Shell PHP
windows系统配置nginx环境运行pbootcms访问首页直接404的问题
windows系统配置nginx环境运行pbootcms访问首页直接404的问题
|
6月前
|
Python Windows
【Azure 应用服务】App Service For Windows 环境中部署Python站点后,如何继续访问静态资源文件呢(Serving Static Files)?
【Azure 应用服务】App Service For Windows 环境中部署Python站点后,如何继续访问静态资源文件呢(Serving Static Files)?
|
6月前
【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn
【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn
|
网络协议 Windows
Windows下通过脚本快速修改IP地址
Windows下通过脚本快速修改IP地址 如果通过Windows的网络属性修改Ip/网关,真是太麻烦了。 经常要切换ip,所以我写了两个脚本: c:\办公室.
2110 0
|
网络协议 Windows 缓存
Windows下通过脚本快速修改IP地址 案例
@echo off :main cls color 02 echo.--------------------------------------------- echo.
1110 0