How to block specific user agents on #Nginx web server.
create /etc/nginx/useragent.rules, & define a map with all blocked user agents as:
map $http_user_agent $putoagent {
default 0;
~*malicious 1;
~*backdoor 1;
~*netcrawler 1;
~Puto 1;
~webbandit 1;
}
open an nginx configuration file of your website, which contains http section, & add
http {
…
include /etc/nginx/useragent.rules
}
https://www.xmodulo.com/block-specific-user-agents-nginx-web-server.html