Drop unwanted connections

Viewed 14244

I want to block unwanted Bots from accessing sites on the server.

Can nginx drop / kill the connection right away when a certain Bot is detected?

if ($http_user_agent ~ (agent1|agent2) ) {
    **KILL CONNECTION**;
}

Something like example above.

3 Answers
Related