Knowledge Base

LiteSpeed Web Server: Enable “noabort”

If you use the LiteSpeed Web Server (LSWS), you might be having issues with your WordPress installations and you might not even be aware of it.

Or you were made aware of it by a “LiteSpeed Web Server (LSWS) configuration issue” notice in your dashboard from one of CSSIgniter’s WordPress products. Let’s see what the issue is and how to fix it.

The behavior

In order to avoid wasting resources, LSWS will silently kill a PHP process as soon its connection to it is closed; for example, when closing your browser’s window while the page is still loading. Although this is generally a good thing, WordPress (as well as some themes and plugins) depend on processes running even if the connection is closed.

WP-Cron specifically runs based on that assumption. On every page load, WordPress sends a non-blocking request to wp-cron.php is made. Non-blocking here simply means that WordPress doesn’t wait for the request to end; it closes the connection instantly, so that the the user doesn’t have to wait.

The problem

But WP-Cron is used by countless themes and plugins, and WordPress itself, and we just said LSWS kills such processes, silently! Doesn’t that mean that that a lot of scheduled jobs never ran, or were killed halfway?

Yes. Yes it does!

The fix

Fortunately, LSWS provides a way to disable this behavior selectively, or even globally (not recommended). This is achieved by enabling the No Abort option, either via the WebAdmin Console or via the .htaccess file.

We are going the .htaccess route, and we will add the following code (provided by LiteSpeed) via which we will enable noabort for wp-cron.php, as well as all scripts under the wp-admin/ folder, but only for logged in users:

<IfModule LiteSpeed>
    <IfModule mod_rewrite.c>
        RewriteEngine On
        # Set noabort for WP Cron scripts
        RewriteRule ^wp-cron.php$ - [E=noabort:1]
        # Set noabort if user is logged in and URL is an Admin URL
        RewriteCond %{REQUEST_URI} ^(.*)?wp-admin
        RewriteCond %{HTTP_COOKIE} ^.*wordpress_logged_in_.*$
        RewriteRule .* - [E=noabort:1]
    </IfModule>
</IfModule>

Make sure to add this code above the WordPress block that starts with:

# BEGIN WordPress

That should do it!

The Ignition Framework, Ignition-based themes, and AudioIgniter plugin should detect the change and no longer display the “LiteSpeed Web Server (LSWS) configuration issue” admin notice.

Your host or administrator may also have enabled No Abort globally but the notice keeps appearing. In this case, and after your double-check that it is indeed enabled, just dismiss the notice to no longer see it.

Plugins such as WordFence and BackupBuddy also depend on this configuration, so the noabort code might already be in your .htaccess file. Make sure you don’t have it multiple time to avoid potential problems!

In LiteSpeed’s website you can find more technical information about noabort, as well as alternative configuration methods such as via environmental variables.