LiteSpeed aborts Wordfence scans and updates. How do I prevent that?
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 <IfModule rewrite_module> RewriteEngine On RewriteRule .* - [E=noabort:1] </IfModule> # 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 <IfModule Litespeed> RewriteEngine On RewriteRule .* - [E=noabort:1] </IfModule> # END litespeed noabort
# BEGIN litespeed noabort SetEnv noabort 1 # END litespeed noabort
Thanks to wwwolf for additional testing.