include agent_deny.conf;

conf下添加

#禁止Scrapy|curl等工具的抓取

if ($http_user_agent ~* (Scrapy|Curl|HttpClient))

{

    return 403;

}

 

#禁止指定UA及UA为空的访问

 

if ($http_user_agent ~ "FeedDemon|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|CoolpadWebkit|Java|Feedly|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|YisouSpider|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms|^$" )

{

    return 403;            

}

#禁止非GET|HEAD|POST方式的抓取

if ($request_method !~ ^(GET|HEAD|POST)$)

{

  return 403;

}

相关文章:

  • 2021-10-23
  • 2022-01-01
  • 2021-11-16
  • 2021-12-23
  • 2022-02-14
  • 2021-09-03
  • 2022-12-23
  • 2021-12-14
猜你喜欢
  • 2021-12-27
  • 2021-12-25
  • 2022-02-03
  • 2021-11-20
  • 2021-10-09
  • 2022-01-03
  • 2021-09-15
相关资源
相似解决方案