• Resolved Eurisko

    (@eurisko)


    I’ve seen a couple of issues about scans not running on Litespeed servers and the following steps being recommended: https://www.wordfence.com/help/advanced/system-requirements/litespeed/

    We’ve added the code to our .htaccess and didn’t have any issues with the scan, but then we started having issues where – because the server doesn’t abort processes, we have several hanging processes causing the server to fail (HTTP 500). To deal with this we’ve been manually uncommenting and then re-commenting out the .htaccess code. With 20+ websites, this process can be really slow, so we only run Wordfence scans when we suspect a site might already be compromised.

    I saw that Wordfence offers a central dashboard called Wordfence Central, but with our current process it isn’t posible to make use of the dashboard, since we’d need to manually edit the .htaccess code.

    I’m wondering if Wordfence is aware of Rewrite rule that would target all the specific files that the plugin uses, so we can keep the code uncommented and not worry about the server falling over. Is there a regex rule that would target all the specific files needed to run the Wordfence scan (not .*)? Or list of the files that we’d need to noabort somewhere?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support wfpeter

    (@wfpeter)

    Hi @eurisko,

    May I ask which processes seem to be causing the server to fail? We’re happy to see error log entries or other diagnostics you’ve used to find them. Feel free to partially censor any paths that identify your website or server.

    I’ve not seen an issue like this with using the noabort code before, so it might be helpful to us in deciding whether something can be done on the server to prevent the hanging processes. I appreciate manually altering files on a regular basis isn’t ideal.

    Many thanks,
    Peter.

    Thread Starter Eurisko

    (@eurisko)

    Hey Peter.

    The error happened back in early December last year. The website is fairly heavy, since it uses Elementor and WooCommerce. Near the begining of December we had the server fall over once or twice. Giving us a 503 Service Unavailable error. Each time I think I ended up fixing it by running the following command: pkill -9 -u <username> as it would kill all hanging processes.

    After the 3rd time though, I went into check the resources in top and there was one proccess running at 90 %CPU and had been running for a couple of hours. top only gives us the Command name which is lsphp (LiteSpeed PHP, I think). So it’s hard to tell what process this was, only that it was using PHP.

    We did a couple of things to improve the server like double all resources. I also ran pkill again and commented out the noabort code from the htaccess. We haven’t had any issues since. We were able to return the resources back to their original state at the begining last month without issues.

    Regards,
    Brendan Gilet

    Thread Starter Eurisko

    (@eurisko)

    The hosting providers have recommended that we use the following .htaccess Rewrite rule instead:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/wordfence-waf\.php$
    RewriteRule .* - [E=noabort:1]
    </IfModule>

    I’m not very proficient in writing Rewrite Rules, but would that work?

    Plugin Support wfpeter

    (@wfpeter)

    Hi @eurisko,

    Unfortunately that code would be ineffective. The Wordfence scan that requires noabort to prevent timeouts is scanning all of your files site-wide for threats and not just the wordfence-waf.php, which is related to the firewall portion of the plugin. It might be more effective to test the following:

    <IfModule LiteSpeed>
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^wp-admin/admin-ajax\.php$ - [E=noabort:1,E=noconntimeout:1]
    RewriteRule ^wp-cron\.php$ - [E=noabort:1,E=noconntimeout:1]
    </IfModule>
    </IfModule>

    Those files will be used frequently during the scan, although I can’t guarantee it’ll solve the problem due to the unknown reason for lsphp needing to be killed manually.

    You can also exclude paths from the Wordfence scan in Wordfence > All Options > Advanced Scan Options > Exclude files from scan that match these wildcard patterns. If there are any particularly large folders created by caching plugins, or containing content such as images that can’t be altered by regular site users, you could add those to try cutting the scan time.

    If the above rewrite code makes no difference. It could help us to send a diagnostic report to wftest @ wordfence . com from the top of the Wordfence Tools > Diagnostics page. Click on “Send Report by Email”. Any configuration errors or server-specifics that we’re not aware of might help.

    Please add your forum username where indicated and respond here after you have sent it as the inbox is not monitored.

    Many thanks,
    Peter.

    Thread Starter Eurisko

    (@eurisko)

    Hey Peter,

    Letting you know that the code above works correctly. We’ll slowly roll out the code across our websites and monitor for hanging processes.

    Thank you for your help!

    Regards,
    Brendan Gilet

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.