我想阻止不需要的Bot访问服务器上的站点。
当检测到某个Bot时,nginx可以立即删除/终止连接吗?
if ($http_user_agent ~ (agent1|agent2) ) {
**KILL CONNECTION**;
}
类似于上面的示例。
请您参考如下方法:
if ($http_user_agent ~ (agent1|agent2) ) {
return 444;
}
Reference documentation
More elaborative documentation


