Panellicense

Migrate from Nginx or Apache to LiteSpeed Web Server

Drop-in LSWS migration from Apache plus rewriting Nginx vhosts to LiteSpeed config, with cache validation and rollback steps.

5 min readUpdated 2026-05-16migration · nginx · apache · htaccess
schema: HowToschema: FAQPage

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 directiveLSWS 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:

  1. Virtual Hosts → Add — name example.com, vhost root /usr/local/lsws/conf/vhosts/example.com/, doc root /var/www/example.

  2. External App → Add → LSAPI App — name phpfpm_example, address uds:///run/php-fpm/www.sock, max connections 35.

  3. Script Handler → Add — suffix php, handler phpfpm_example.

  4. Create /var/www/example/.htaccess:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
  5. Listeners → SSL listener → Virtual Host Mappings — map example.com and www.example.com to the new vhost.

  6. 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?+
Yes — natively, with full mod_rewrite, mod_security, and AuthBasic support. This is what makes the Apache migration a drop-in. Nginx config has no equivalent parser and must be translated by hand.
How long does an Apache to LiteSpeed migration take?+
About 30 minutes per single-server cPanel box, including PHP-FPM detection and a cache-header verification. Nginx migrations take roughly an hour per non-trivial vhost.
Can I keep Apache installed as a fallback after switching to LiteSpeed?+
Yes, and you should for the first week. Stop and disable httpd so it doesn't race for port 80 on boot, but keep the package installed so a rollback is one systemctl command.
Will my existing PHP-FPM pools work with LiteSpeed?+
Yes. Run /usr/local/lsws/admin/misc/lsws_phpconfig.sh after install and LSWS auto-discovers each pool under /etc/php-fpm.d/ and writes matching External App entries.

Next steps

Switch in an afternoon

Switch from your current reseller — free.

We migrate active cPanel, Plesk, LiteSpeed and CloudLinux licenses from any reseller. We prorate the first month so you never pay twice, and your customers see zero downtime during the swap.