I'm trying to deny some user agents I constantly see probing my nginx
web server.
If I have this in my .conf
file
## Block http user agent - morpheus fucking scanner ##
if ($http_user_agent ~* (morfeus fucking scanner|ZmEu)) {
return 403;
}
I get the following error when starting services:
nginx: [emerg] invalid condition "$http_user_agent" in /etc/nginx/sites-enabled/siteXXX:19
nginx: configuration file /etc/nginx/nginx.conf test failed
If I place quotation marks around it, it starts but doesn't deny as I would expect it to.
## Block http user agent - morpheus fucking scanner ##
if ($http_user_agent ~* "(morfeus fucking scanner|ZmEu)") {
return 403;
}
Any ideas? Im looking for a case-insensitive user agent deny.