Block particular user agent (bots) in nginx

From DevOps Notebook
Revision as of 18:55, 8 October 2020 by MilosZ (talk | contribs) (Created page with "<pre> # case insensitive matching if ($http_user_agent ~* (netcrawl|npbot|malicious|LWP::Simple|BBBike|wget|jorgee)) { return 403; } </pre>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
    # case insensitive matching
    if ($http_user_agent ~* (netcrawl|npbot|malicious|LWP::Simple|BBBike|wget|jorgee)) {
        return 403;
    }