• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Blocking bad bots

tkalfaoglu

Silver Pleskian
The server seems to be mainly servicing https bots while its running, and it annoyed me.
So I wrote some nginx code to stop it (inserted via the PLESK interface into the nginx configurations box):

if ($http_user_agent ~ (MJ12bot|LieBaoFast|UCBrowser|MQQBrowser|Mb2345Browser|gumgum-bot|postmanruntime|ag_dm_spider|scrapy|chimebot|trendkite-akashic-crawler|ZoominfoBot|Sogou|ALittle|Keybot|Buck|curl|webprosbot|RestSharp|Snap|SemrushBot|AhrefsBot|DataForSeoBot)) {
return 403;
}


It appears to work, but how can I enable this for ALL sites.. I tried it in nginx.conf , but it complained that "if" cannot be put there..
Thanks! -t
 
You could also add this inside your ModSecurity.
That way if 1 site gets "attacked", it's blocked all across your server.
 
Thanks - in the past I had problems with modsecurity - blocking things it should not have, so I'm a bit shy about using it
 
Back
Top