通過web.config或.htaccess規(guī)則文件屏蔽User_Agent(UA)訪問查找網(wǎng)站訪問較多的 User_Agent可通過“訪問統(tǒng)計(jì)”功能進(jìn)行查看,登錄進(jìn)入到虛擬主機(jī)管理面板點(diǎn)擊“訪問統(tǒng)計(jì)”。 進(jìn)入訪問統(tǒng)計(jì)詳細(xì)頁面--找到“瀏覽器 (前 10) 點(diǎn)擊:全部列出/版本 ”查看訪問占比較大的客戶端(User_Agent)瀏覽器版本。
從上圖中可以看出“Chrome 125.0.0.0”這個(gè)客戶端(User_Agent)瀏覽器訪問網(wǎng)站網(wǎng)頁數(shù)及文件數(shù)占比較大。正常情況網(wǎng)站訪問流量不會(huì)超標(biāo),而此時(shí)出現(xiàn)流量超標(biāo)。 這種情況基本可判斷為屬于異常訪問請(qǐng)求,可按以下方式設(shè)置攔截。 屏蔽多個(gè)以"|"分隔,且同樣適用屏蔽蜘蛛的訪問爬行,規(guī)則如下: Linux主機(jī)下規(guī)則文件.htaccess(可手工創(chuàng)建.htaccess文件到站點(diǎn)根目錄)添加以下規(guī)則: <IfModule mod_rewrite.c>
RewriteEngine On
#Block spider
RewriteCond %{HTTP_USER_AGENT} "125.0.0.0|107.0.0.0|113.0.0.0|Bytespider|Amazonbot|YisouSpider|^$" [NC]
RewriteRule !(^robots\.txt$) - [F]
</IfModule>Windows主機(jī)下規(guī)則文件web.config (可手工創(chuàng)建web.config文件到站點(diǎn)根目錄)添加以下規(guī)則: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Block spider">
<match url="(^robots.txt$)" ignoreCase="false" negate="true" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="125.0.0.0|107.0.0.0|113.0.0.0|Bytespider|Amazonbot|YisouSpider|^$" ignoreCase="true" />
</conditions>
<action type="AbortRequest"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>網(wǎng)站流量超標(biāo)排查
|
|||||
| >> 相關(guān)文章 | |||||
|
|
|||||
400-028-5800
028-62778877
您好,非正常上班時(shí)間若有緊急技術(shù)問題,請(qǐng)撥總機(jī)后按7號(hào)鍵, 其他問題請(qǐng)?zhí)峤还位蛟谏习鄷r(shí)間聯(lián)系,謝謝支持!