apache、iis6、ii7獨(dú)立ip主機(jī)屏蔽限制ip訪問(適用vps云主機(jī))注: Linux下 規(guī)則文件.htaccess(手工創(chuàng)建.htaccess文件到站點(diǎn)根目錄) <IfModule mod_rewrite.c>
RewriteEngine On
#Block ip
RewriteCond %{http:X-Forwarded-For} ^(8.8.4.4|8.8.8\.) [OR]
RewriteCond %{REMOTE_ADDR} ^(8.8.4.4|8.8.8\.) [OR]
RewriteCond %{http:X-Real-IP} ^(8.8.4.4|8.8.8\.) [NC]
RewriteRule (.*) - [F]
</IfModule>windows2003下 規(guī)則文件httpd.conf
#Block ip
RewriteCond %{http:X-Forwarded-For} ^(8.8.4.4|8.8.8\.) [OR]
RewriteCond %{REMOTE_ADDR} ^(8.8.4.4|8.8.8\.) [OR]
RewriteCond %{http:X-Real-IP} ^(8.8.4.4|8.8.8\.) [NC]
RewriteRule (.*) - [F]windows平臺(tái)IIS7及以上版本 規(guī)則文件web.config (手工創(chuàng)建web.config文件到站點(diǎn)根目錄) <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="band ip">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_X_FORWARDED_FOR}" pattern="^(8.8.4.4|8.8.8\.)" ignoreCase="false" />
<add input="{REMOTE_ADDR}" pattern="^(8.8.4.4|8.8.8\.)" ignoreCase="false" />
<add input="{HTTP_X_REAL_IP}" pattern="^(8.8.4.4|8.8.8\.)" ignoreCase="false" />
</conditions>
<action type="AbortRequest" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>nginx寶塔面板設(shè)置屏蔽IP規(guī)則,可以在寶塔面板-》對(duì)應(yīng)站點(diǎn)偽靜態(tài)處設(shè)置: if ( $http_x_forwarded_for ~* '8.8.8.8|114.114.114.114') {return 444;} if ( $remote_addr ~* '8.8.8.8|114.114.114.114') {return 444;} if ( $http_x_real_ip ~* '8.8.8.8|114.114.114.114') {return 444;}
|
|||||
| >> 相關(guān)文章 | |||||
|
|
|||||
400-028-5800
028-62778877
您好,非正常上班時(shí)間若有緊急技術(shù)問題,請(qǐng)撥總機(jī)后按7號(hào)鍵, 其他問題請(qǐng)?zhí)峤还位蛟谏习鄷r(shí)間聯(lián)系,謝謝支持!