Wordfence and LiteSpeed
The LiteSpeed web server has been known to kill or stop processes that take more than a few seconds to run. It does not stop these processes gracefully but simply kills them silently. This guide outlines how to prevent this.
If LiteSpeed aborts Wordfence scans and updates
The LiteSpeed web server has been known to kill or stop processes that take more than a few seconds to run. It does not stop these processes gracefully but simply kills them silently.
When using software like Wordfence or backup software that needs a little more time to complete certain tasks then this can lead to problems. If you are using Wordfence’s auto-update feature, this may lead to your site becoming unusable, if LiteSpeed kills an upgrade halfway through copying files.
To prevent this you need to make a simple change:
Find your site’s main “.htaccess” file. This file usually exists in the document root directory where WordPress is installed. Open the file with a text editor. Find the line that says “# BEGIN WordPress” and add this code above it:
# BEGIN LiteSpeed noabort
<IfModule rewrite_module>
RewriteEngine On
RewriteRule .* - [E=noabort:1]
</IfModule>
# END liteSpeed noabort
This will instruct LiteSpeed to not abruptly abort requests. It should allow your site to update correctly, allow Wordfence scans to run to completion, and it will also allow any backup plugins on your WordPress site to function without problems from timing out.
In some cases, depending on the server configuration, the above code may not help. Alternative code blocks that may work are:
# BEGIN LiteSpeed noabort
<IfModule Litespeed>
RewriteEngine On
RewriteRule .* - [E=noabort:1]
</IfModule>
# END liteSpeed noabort
Or:
# BEGIN LiteSpeed noabort
SetEnv noabort 1
# END liteSpeed noabort
Bypass the LiteSpeed “noabort” check
If you are certain that your hosting provider uses LiteSpeed and that the “External Application Abort” function is set to “No Abort” then you can enable this option so that Wordfence will skip checking for “noabort” in your site’s “.htaccess” file. For more information see the global Wordfence option Bypass the LiteSpeed “noabort” check.