Nginx 通过客户端标识过滤请求
网页爬虫对站点收录和推广有好处,但大量蜘蛛涌入可能会造成网站瘫痪,通过配置 Nginx 可以限制爬虫请求。在 Nginx 的配置 conf.d
目录下增加请求频率限制定义文件 user-agent-rate-limit.conf
。
1 | # define two rules: hard and soft |
应用规则
1 | server { |
参考:
网页爬虫对站点收录和推广有好处,但大量蜘蛛涌入可能会造成网站瘫痪,通过配置 Nginx 可以限制爬虫请求。在 Nginx 的配置 conf.d
目录下增加请求频率限制定义文件 user-agent-rate-limit.conf
。
1 | # define two rules: hard and soft |
应用规则
1 | server { |
参考: