News

Fix PHP-FPM using 100% CPU

Ha! Sorry for my giggle. I’ve been there, done that!

In summary, there may be different reasons, but in my case, the culprit was a crawler bot service from somewhere I do not know of, hammering my woocommerce website.

The solution was to add a dedicated line in my Nginx to block off that specific bot.

  if ($http_user_agent ~* (PetalBot|AnotherBot|AndAnotherBot) ) {
    return 403;
  }

This is a very primitive solution that won’t fix your woes if you’re under a coordinated DDoS kinda attack. This solution is perhaps best at handling more of a one-off rogue random crawler service that’s spamming your WordPress installation.

There may be other effective, easily scalable solutions, but for my use case, the above worked fine.

I’ll have to look into a sustainable solution. Enlighten me below if you know of any “good” solution for handling such bots.

In my case, I wanted to handle the bot requests at the point of entry level, without having it touch my WordPress, so I was looking into solutions along the lines of measures that sit in front of the PHP i.e in this case, my Nginx.

By checking the Nginx logs for your virtual host conf, you’ll be able to know from the access logs the bot name that’s hammering your server.

Anyway, I hope this helps. See you in the next article

Related Articles

Back to top button