概述
#forbidden Scrapy
if ($http_user_agent ~* (Scrapy|Curl|HttpClient))
{
return 403;
}
#forbidden UA
if ($http_user_agent ~ "Bytespider|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;
}
#forbidden not GET|HEAD|POST method access
if ($request_method !~ ^(GET|HEAD|POST)$)
{
return 403;
}
nginx中location模块的详细参数介绍
Nginx的Location可以有以下几个匹配:
- = 严格匹配这个查询。如果找到,停止搜索。
- ^~ 匹配路径的前缀,如果找到,停止搜索。
- ~ 为区分大小写的正则匹配
- ~* 为不区分大小写匹配
5.!和!*分别为区分大小写不匹配及不区分大小写不匹配
https://www.cnblogs.com/itsharehome/p/11114588.html
最后
以上就是健忘翅膀为你收集整理的nginx反爬虫配置的全部内容,希望文章能够帮你解决nginx反爬虫配置所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复