Attack my apache web server

Discussion in 'Systems Administration' started by JuanDouCore_, Apr 28, 2019.

  1. From today a damn connection is fucking my web server. causing it to fall and be out of line. Try many methods to limit connections by ip and everything but the same keeps falling. I do not know what else to do. In the apache2 error logs it throws the last error before the web crashes:
    [Sun Apr 28 18:24:53.176314 2019] [mpm_prefork:error] [pid 1661] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

    I would appreciate the help to avoid this. The antidodes of soyoustart do not act here.
  2. Have you considered raising the max request workers lol?
    • Funny Funny x 1

    It seems that 256 is the default, it's probably an easy fix with a basic firewall that drops any incoming traffic that hits the server beyond the average, or a hardset number. Try looking into UFW/iptables and follow some example directives. People that browser around normally or a bot hitting it like Bing/Google spiders, they will possibly build a queue up as well. Just drop their traffic if it's x connections from y ip in z time, etc. So they don't even get close to MySQL/PHP/Apache services -- hitting limits. If a connection takes too long, just drop it. If it's beyond average, it's not worth waiting for it, you want to free up PHP app procs queue building.

    Note that this doesn't always mean that there's a problem with Apache either, or your firewall.. It can mean you have poorly written PHP code that's just slow and building up a queue so to speak (to be basic). Improving the PHP handling and caching data might help with this a lot as well.

    If you have bad PHP code that takes too long, it builds up this queue, ..

    When a request comes in to a slow PHP script, then please realise that PHP can only run a limited amount of number of requests simultaneously per app. If a PHP script runs poorly, then a slightest bunch of traffic can build this queue and reach a limit. When these requessts come in and the queue builds php procs are trying to go through these requests, then apache builds a queue and waits until php completes an existing request. When the queue is too fool, php becomes too big, and you get the 'server reached MaxRequestWorkers setting' msg. Maybe check your PHP slow log to find these isuses first, because raising limits.