近日有不少客户反馈,虚拟主机或者服务器流量突然巨大,后经查为一个域名ads.acesse.com恶意访问,每天消耗流量上十G,下面提供方法可以解决此问题。
Linux下 规则文件.htaccess(手工创建.htaccess文件到站点根目录)
<IfModule mod_rewrite.c>
RewriteEngine On
#Block domain
RewriteCond %{HTTP_REFERER} ads.acesse.com [NC]
RewriteRule ^(.*)$ -[F]
</IfModule>
windows2003下 规则文件httpd.conf(在虚拟主机控制面板中用 “ISAPI筛选器自定义设置 " 开启自定义伪静态 Isapi_Rewite3.1 )
#Block domain
RewriteCond %{HTTP_REFERER} ads.acesse.com [NC]
RewriteRule ^(.*)$ -[F]
windows2008下 规则文件web.config (手工创建web.config文件到站点根目录)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="屏蔽ads.acesse.com访问">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_REFERER}" pattern="ads.acesse.com" />
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
查看设置过后的日志记录:
2014-08-14 08:18:43 GET / - - 61.139.126.203 HTTP/1.0 Mozilla/5.0+(Windows+NT+5.1;+rv:31.0)+Gecko/20100101+Firefox/31.0 http://ads.acesse.com/surf/surf_top.php 403 4820 15
2014-08-14 08:18:43 GET / - - 61.139.126.203 HTTP/1.0 Mozilla/5.0+(Windows+NT+5.1;+rv:31.0)+Gecko/20100101+Firefox/31.0 http://ads.acesse.com/surf/surf_top.php 403 4820 0
2014-08-14 08:18:44 GET /favicon.ico - - 61.139.126.203 HTTP/1.0 Mozilla/5.0+(Windows+NT+5.1;+rv:31.0)+Gecko/20100101+Firefox/31.0 - 304 183 15
2014-08-14 08:19:22 GET / - - 118.123.16.14 HTTP/1.0 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+5.1;+Trident/4.0) http://ads.acesse.com/surf/surf_top.php 403 4820 0
状态已经是403 ,这样流量将会降低非常多 ,非常感谢您长期对我司的支持!
备注:此规则在Rewrite3.1版本有效
南京服务器托管 | 南京服务器租用 | 南京主机托管 | 南京主机租用 | 南京华昊数据 | www.467.cn |
TEL:400-025-9-467 025-58633651 QQ:23190019