1
2
3
4
5
6
7
8
9
10
11
12
|
#禁止Scrapy等工具的抓取
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
;
}
|
1
2
3
4
|
# git clone https://github.com/agentzh/lua-redis-parser.git
# export LUA_INCLUDE_DIR=/usr/include/lua5.1
# make CC=gcc
# make install CC=gcc
|
未完待续...