How to Set Up OpenLiteSpeed on a VPS: The Nginx Alternative with Built-In Cache and LSCache

How to Set Up OpenLiteSpeed on a VPS: The Nginx Alternative with Built-In Cache and LSCache

OpenLiteSpeed (OLS) is the open-source version of LiteSpeed Web Server — the same technology behind many commercial WordPress managed hosting platforms. Its built-in LiteSpeed Cache (LSCache) for WordPress eliminates the need for WP Rocket, W3 Total Cache, or Varnish. OLS includes native LSAPI PHP handling (faster than FastCGI), HTTP/3 QUIC support, and a WebAdmin panel for GUI configuration.

OpenLiteSpeed vs Nginx: When to Choose OLS

Factor OpenLiteSpeed Nginx + PHP-FPM
PHP handler LSAPI (fastest for PHP) FastCGI (fast)
Built-in page cache Yes (LSCache) No (requires Varnish or Redis)
HTTP/3 QUIC Yes (native, no config) Yes (Nginx 1.25+, manual)
Admin panel Yes (WebAdmin GUI) No (config file only)
WordPress cache plugin LiteSpeed Cache (free, excellent) WP Rocket, W3 Total Cache (paid)
PageSpeed (out of box) 90–98 50–70 without optimization
Learning curve Medium (different from Nginx) Low (widely documented)

Step 1: Install OpenLiteSpeed

sudo apt update && sudo apt upgrade -y

# Add official LiteSpeed repository
wget -O - https://repo.litespeed.sh | sudo bash

sudo apt install -y openlitespeed lsphp82 lsphp82-common lsphp82-mysql \
  lsphp82-imagick lsphp82-redis lsphp82-imap lsphp82-intl lsphp82-curl

# Start and enable OLS
sudo systemctl enable lsws
sudo systemctl start lsws

# Set WebAdmin password
sudo /usr/local/lsws/admin/misc/admpass.sh

Access WebAdmin at http://YOUR_VPS_IP:7080 with the credentials you just set.

Step 2: Configure PHP Settings

sudo nano /usr/local/lsws/lsphp82/etc/php/8.2/litespeed/php.ini
memory_limit = 256M
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
max_input_vars = 5000
date.timezone = UTC

; OPcache settings
opcache.enable = 1
opcache.memory_consumption = 128
opcache.max_accelerated_files = 10000
opcache.interned_strings_buffer = 16
opcache.revalidate_freq = 60
sudo systemctl restart lsws

Step 3: Download and Install WordPress

sudo mkdir -p /var/www/wordpress
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz --strip-components=1 -C /var/www/wordpress
rm latest.tar.gz
sudo chown -R nobody:nogroup /var/www/wordpress
cd /var/www/wordpress
cp wp-config-sample.php wp-config.php
sudo nano wp-config.php   # Enter your database credentials

Step 4: Configure MariaDB

sudo mysql -u root -p
CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'StrongPassword!';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Configure OpenLiteSpeed Virtual Host

In WebAdmin (port 7080):

  1. Virtual Hosts → Add → Name: wordpress, Root: /var/www/wordpress
  2. Script Handler → Add → Suffix: php, Type: LiteSpeed SAPI, Name: lsphp82
  3. Rewrite → Enable Rewrite: Yes, Auto Load from .htaccess: Yes
  4. Listeners → Default → Virtual Host Mappings → Add: yourdomain.comwordpress

Create the WordPress .htaccess:

sudo nano /var/www/wordpress/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Step 6: Configure SSL with Let’s Encrypt

sudo apt install -y certbot
sudo certbot certonly --webroot -w /var/www/wordpress/ \
  -d yourdomain.com -d www.yourdomain.com

In WebAdmin: Listeners → Add HTTPS Listener → Port 443 → SSL tab → configure certificate paths:

  • Private Key: /etc/letsencrypt/live/yourdomain.com/privkey.pem
  • Certificate: /etc/letsencrypt/live/yourdomain.com/fullchain.pem
  • Enable QUIC: Yes

Step 7: Install and Configure LiteSpeed Cache Plugin

In WordPress Admin: Plugins → Add New → Search “LiteSpeed Cache” → Install and Activate.

Recommended settings:

  • Cache → Cache Control Settings: Enable Cache ✓ | Cache TTL: 604800 (1 week)
  • Cache → Browser: Enable Browser Cache ✓ | Browser Cache TTL: 31557600
  • Page Optimization → CSS: Minify ✓ | Combine ✓ | HTTP/2 Push ✓
  • Page Optimization → JS: Minify ✓ | Combine ✓ | Load JS Deferred ✓
  • Page Optimization → HTML: Minify ✓
  • Page Optimization → Media: Lazy Load Images ✓ | WebP Replacement ✓

Step 8: Manage OpenLiteSpeed

# Graceful restart (apply configuration changes)
sudo systemctl reload lsws

# Full restart
sudo systemctl restart lsws

# Check status
sudo systemctl status lsws

# View error logs
sudo tail -f /usr/local/lsws/logs/error.log

# View access logs
sudo tail -f /usr/local/lsws/logs/access.log

Expected Performance Results

Metric Nginx (default, no cache) OpenLiteSpeed + LSCache
TTFB (cached pages) 300–800ms 5–20ms
PageSpeed score (mobile) 50–70 90–98
Requests/second ~50 ~3,000+
Core Web Vitals (LCP) 3–6s <1s

Getting Started

OpenLiteSpeed with LiteSpeed Cache is an excellent out-of-the-box WordPress performance stack. Ubuntu VPS plans at VPS.DO support OLS installation from the official LiteSpeed repository. The 2 vCPU / 2 GB RAM plan comfortably handles a single high-traffic WordPress site with LSCache enabled — cache hits use negligible PHP resources and are served directly by the OLS cache layer.

Conclusion

OpenLiteSpeed with LiteSpeed Cache delivers WordPress performance (90+ PageSpeed scores, sub-20ms TTFB for cached pages) without requiring Varnish, Redis page caching, or paid cache plugins. The built-in LSAPI PHP handler outperforms FastCGI, the native LSCache module outperforms file-based caches, and HTTP/3 QUIC support makes OLS the most feature-complete open-source web server for WordPress hosting out of the box.

Fast • Reliable • Affordable VPS - DO It Now!

Get top VPS hosting with VPS.DO’s fast, low-cost plans. Try risk-free with our 7-day no-questions-asked refund and start today!