Home >Operation and Maintenance >Nginx >How to modify nginx configuration to limit the frequency of malicious crawlers
The code is as follows:
#全局配置 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; }
If the set limit frequency is exceeded, a 503 will be given to the spider.
The above is the detailed content of How to modify nginx configuration to limit the frequency of malicious crawlers. For more information, please follow other related articles on the PHP Chinese website!