Skip to content

Installing LiteSpeed Web Server on a cPanel server

Step-by-step guide to replacing Apache with LiteSpeed on a cPanel server, covering license setup, PHP handler binding, and post-install verification.

Replacing Apache with LiteSpeed Web Server on a cPanel server is a two-step process: install the WHM plugin that binds LSWS into the cPanel ecosystem, then rebind PHP handlers so every account picks up the performance gains automatically. This guide targets server administrators managing cPanel/WHM hosts who want a reproducible, low-downtime switchover. You will end up with LiteSpeed serving all vhosts, lsphp handling PHP, and LSCache available for WordPress sites on the same box.

How to verify

Check whether an existing LSWS install is present before starting, then confirm Apache is still running:

/usr/local/lsws/bin/lshttpd -v 2>/dev/null || echo "LSWS not installed"
httpd -v
systemctl is-active httpd
whmapi1 get_installed_plugins

After installation, confirm LSWS owns port 80 and 443:

ss -tlnp | grep -E ':(80|443)'
/usr/local/lsws/bin/lshttpd -v
curl -sI http://127.0.0.1 | grep -i server

What’s happening

WHM ships with an official LiteSpeed plugin that hooks into cPanel’s Apache configuration pipeline. Rather than replacing Apache binaries outright, the plugin installs LSWS alongside Apache and then sets LSWS as the active web server. WHM continues generating Apache-compatible configuration files — httpd.conf and per-vhost includes — and LSWS reads them directly, translating directives it understands and ignoring those it cannot use. This means .htaccess files, mod_rewrite rules, and most VirtualHost blocks work without modification.

PHP is where the biggest operational change happens. Apache on cPanel typically runs PHP through mod_php (DSO) or PHP-FPM. LiteSpeed replaces both with its own lsphp binaries, which speak the LiteSpeed Server Application Programming Interface (LSAPI). Each lsphp version is a separate binary — lsphp81, lsphp82, lsphp83 — installed in /usr/local/lsws/. The WHM EasyApache integration lists these as alternative PHP implementations, so you manage them from the same interface your team already uses.

cPanel accounts do not need to change their document roots, .htaccess files, or PHP version selections. The switchover is transparent at the application layer. The operational difference is that LSWS spawns PHP workers differently from FPM: workers are tied to the LSWS process group rather than a separate pool manager, and the LSAPI protocol is faster over a local socket than FastCGI for most request patterns.

The procedure

1. Purchase or trial a LiteSpeed license.

Go to the LiteSpeed customer portal and obtain a license serial for the server’s IP. A 15-day trial is available without payment. Note the serial — you will enter it during installation.

2. Install the WHM plugin via the LiteSpeed installation script.

Log in to the server as root and run:

wget -O - https://www.litespeedtech.com/packages/cpanel/lsws_whm_autoinstaller.sh | bash

The script installs the WHMSonic plugin, downloads the LSWS build for your platform, and drops a license check file under /usr/local/lsws/conf/. When the script finishes, log into WHM and navigate to Plugins → LiteSpeed Web Server to enter the serial key and activate.

3. Install lsphp versions through EasyApache 4.

In WHM, go to Software → EasyApache 4. Under PHP you will now see ea-php81-litespeed, ea-php82-litespeed, etc. alongside the standard Apache packages. Select the versions your accounts use and click Review then Provision. EasyApache installs the lsphp binaries and registers them with the cPanel multi-PHP system.

4. Set the system default PHP handler to LiteSpeed LSAPI.

In WHM, go to MultiPHP Manager → System PHP Version and confirm the default is pointing to a LiteSpeed-capable PHP version. Then go to MultiPHP Manager → PHP Handlers and set the handler to litespeed for all PHP versions that have an lsphp binary installed.

5. Switch the active web server.

In the LiteSpeed WHM plugin, click Switch to LiteSpeed. The plugin stops Apache, starts LSWS, and points the system service at lsws. The cutover takes under 10 seconds. All existing vhosts are served immediately.

6. Rebuild the HTTP configuration and restart.

/scripts/rebuildhttpdconf
/usr/local/lsws/bin/lswsctrl restart

A rebuild ensures any .htaccess or vhost change made between install and cutover is picked up.

7. Confirm cache headers on a test site.

Install the LiteSpeed Cache plugin on a WordPress site on the server, enable caching, then:

curl -sI https://example.com/ | grep -E '(X-LiteSpeed-Cache|Server)'

You should see X-LiteSpeed-Cache: hit on the second request and Server: LiteSpeed in both.

Common pitfalls

ModSecurity rule sets reference Apache-specific variables. LiteSpeed includes its own ModSecurity implementation, but some commercial rule sets use %{REQUEST_FILENAME} in ways that behave differently. Audit your active ModSecurity rule set before switching, particularly around file-extension checks on upload endpoints.

Per-account PHP versions do not automatically migrate to lsphp. If an account was pinned to ea-php74 under Apache, it will try to use lsphp74 after the switch. If you did not install ea-php74-litespeed, those accounts fall back to the system default silently. Check the EasyApache PHP list and install every version that any cPanel account uses.

The .htaccess Options directive has partial support. Options -Indexes works fine. Options +ExecCGI is ignored — LiteSpeed does not execute CGI through .htaccess. If any legacy application relied on CGI via .htaccess, it will break silently after the switch.

CageFS and CloudLinux require an extra step. If the server runs CloudLinux with CageFS, you must remount the cage after changing PHP handlers:

cagefsctl --remount-all

Without this, PHP version changes do not propagate into the cage and accounts return parse errors.

WHM’s Apache-style access logs are replaced by LSWS logs. Apache access logs under /usr/local/apache/logs/ stop receiving new entries after the switch. LSWS writes to /usr/local/lsws/logs/ instead. Update any log shipping or alerting rules to point at the new path.


Stack Harbor handles LiteSpeed installs as part of managed cloud operations, including EasyApache integration, CloudLinux compatibility checks, and post-install cache verification across all hosted accounts. If you would rather hand the switchover to a team that has run it dozens of times, reach out through the knowledge base.