#全局配置 limit_req_zone $anti_spider zone=anti_spider:10m rate=15r/m; #某個server中 limit_req zone=anti_spider burst=30 nodelay; if ($http_user_agent ~* "xxspider|xxbot") { set $anti_spider $http_user_agent; }
超過設置的限定頻率,就會給spider一個503。
上述配置詳細解釋請自行google下,具體的spider/bot名稱請自定義。
--------------------------------------分割線--------------------------------------
知數堂 (http://zhishuedu.com)培訓是由資深MySQL專家葉金榮、吳炳錫聯合推出的專業優質培訓品牌,主要有MySQL DBA實戰優化和Python運維開發課程,是業內最有良心、最有品質的培訓課程。