Home > Operation and Maintenance > Nginx > How to modify nginx configuration to limit the frequency of malicious crawlers

How to modify nginx configuration to limit the frequency of malicious crawlers

PHPz
Release: 2023-05-12 18:25:06
forward
1197 people have browsed it

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;

}
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template