Drop unwanted connections

D_Guy13 picture D_Guy13 · Dec 20, 2013 · Viewed 10.9k times · Source

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.