LiteSpeed Web Server replaces Apache as a near drop-in: it parses httpd.conf and .htaccess natively, takes over port 80/443, and keeps the same docroots. Migrating from Nginx is a different job — there's no nginx.conf parser, so every server and location block has to be translated into LSWS vhost configuration by hand.
This guide covers both. The Apache path takes 30 minutes on a single-server cPanel box; the Nginx path is closer to a day per vhost depending on rewrite complexity. Both end with a cache-header verification and a tested rollback.
Before you start
Take a snapshot. Filesystem snapshot at the hypervisor level if you have one, or tar of /etc, /usr/local/apache (or /etc/nginx), and /var/www if you don't. Note the running version of your current server (httpd -v, nginx -v), the PHP-FPM pools in use, and the public IP — LSWS licences bind to it.
If you're on cPanel/WHM, the path is simpler still: install LiteSpeed via the cPanel plugin handles Apache replacement, port handover, and EasyApache 4 integration as one step. Stop reading this and start there. The manual path below is for non-cPanel servers.
From Apache: install LSWS over the top
LSWS reads existing Apache configuration. Stop Apache, install LSWS, point it at the same configs, and start it on the same ports.
systemctl stop httpd
bash <(wget -O - https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/master/Setup/lsws_install.sh)
The installer prompts for admin password, listener ports (accept 80/443), and the licence serial. Paste the serial from your Client Center — or skip for a 15-day trial and add it later.
Bind PHP-FPM to the existing handlers:
/usr/local/lsws/admin/misc/lsws_phpconfig.sh
This scans /etc/php-fpm.d/, discovers each pool, and writes matching External App definitions into LSWS. Restart and verify:
/usr/local/lsws/bin/lswsctrl restart
curl -sI https://example.com/ | grep -i server
The response should now read Server: LiteSpeed. Existing .htaccess files, RewriteRules, AuthBasic, and mod_security rules continue to work — LSWS implements the Apache directive set natively.
Cache validation
Hit a static asset and a dynamic page:
curl -sI https://example.com/wp-content/themes/twentytwentyfour/style.css | grep -i -E 'server|cache'
curl -sI https://example.com/ | grep -i -E 'server|x-litespeed'
Static assets should return X-LiteSpeed-Cache-Control: public,max-age=... once you add the LSCache plugin or directive. Dynamic pages need LSCache for WordPress configured before they hit.
From Nginx: translate vhosts by hand
Nginx config does not map automatically. Plan to spend an hour per non-trivial vhost. The translation pattern:
| Nginx directive | LSWS equivalent |
|---|---|
server { listen 443 ssl; } | Listener with SSL cert/key in WebAdmin → Listeners |
server_name example.com www.example.com; | Virtual Host Mapping on the listener |
root /var/www/example; | Virtual Host → General → Document Root |
index index.php index.html; | Virtual Host → Index Files |
location / { try_files $uri $uri/ /index.php?$args; } | RewriteRule in .htaccess or Context |
location ~ \.php$ { fastcgi_pass unix:/run/php-fpm.sock; } | External App (LSAPI or proxy) + Script Handler |
gzip on; | Tuning → Gzip Compression (on by default) |
Install LSWS first (same one-liner as above), then for each Nginx vhost build the equivalent in WebAdmin at https://server:7080/.
Worked example: a typical WordPress vhost
The Nginx side:
server {
listen 443 ssl http2;
server_name example.com;
root /var/www/example;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
In LSWS WebAdmin:
-
Virtual Hosts → Add — name
example.com, vhost root/usr/local/lsws/conf/vhosts/example.com/, doc root/var/www/example. -
External App → Add → LSAPI App — name
phpfpm_example, addressuds:///run/php-fpm/www.sock, max connections 35. -
Script Handler → Add — suffix
php, handlerphpfpm_example. -
Create
/var/www/example/.htaccess:RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] -
Listeners → SSL listener → Virtual Host Mappings — map
example.comandwww.example.comto the new vhost. -
Graceful restart:
/usr/local/lsws/bin/lswsctrl restart.
For sites with non-trivial Nginx rewrites — Magento, custom routers, CDN signature checks — extract each location block, port the regex to mod_rewrite syntax in .htaccess, and test each in isolation with curl -v.
Rollback
If LSWS fails verification, the rollback from Apache is one command:
/usr/local/lsws/bin/lswsctrl stop && systemctl start httpd
From Nginx, restore the snapshot or:
/usr/local/lsws/bin/lswsctrl stop && systemctl start nginx
Keep both binaries installed for at least a week. Production traffic surfaces edge cases — a customer's odd .htaccess, a CDN signing path, a webhook IP — that staging never sees.
When you're confident, pick a permanent LiteSpeed licence and systemctl disable the old server. If you're still deciding between LSWS Enterprise and the free OpenLiteSpeed, the LSWS vs OpenLiteSpeed comparison lays out where the paid edition earns its keep.
Does LiteSpeed read Apache .htaccess files?+
How long does an Apache to LiteSpeed migration take?+
Can I keep Apache installed as a fallback after switching to LiteSpeed?+
Will my existing PHP-FPM pools work with LiteSpeed?+
Next steps
- On cPanel, the LiteSpeed install via the cPanel plugin is a faster path than the manual installer.
- Activate caching properly with LSCache for WordPress on cPanel.
- Compare engines before you renew at LSWS vs OpenLiteSpeed, or order a licence.