Wordfence and LiteSpeed

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 […]

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, 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 very simple change:

Find your site’s .htaccess file. This file usually lives in your website root folder. So it may be in a folder like public_html/.htaccess. Open the file with a text editor. Find the line that says “# BEGIN WordPress” and add this code above it:

# BEGIN litespeed noabort

RewriteEngine On
RewriteRule .* - [E=noabort:1]

# END litespeed noabort

This will tell 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 host’s configuration, the above code may not help. An alternate method which may work is this:

# BEGIN litespeed noabort

RewriteEngine On
RewriteRule .* - [E=noabort:1]

# END litespeed noabort

Or:

# BEGIN litespeed noabort
SetEnv noabort 1
# END litespeed noabort

Bypass the LiteSpeed “noabort” check

If you are certain that your host uses LiteSpeed and that “External Application Abort” is set to “No Abort”, you can enable this option so that Wordfence will skip checking for “noabort” in .htaccess. For more information see the Global Wordfence Option Bypass the LiteSpeed “noabort” check.