OpenLiteSpeed is the free, open-source edition of LiteSpeed Web Server and runs well on Ubuntu 22.04 LTS for WordPress, static sites, and PHP applications. The install process is straightforward but has several traps: the WebAdmin console binds to all interfaces by default, the default admin password is easy to guess, and certificate renewal requires a deploy hook or LiteSpeed never loads the renewed cert. This tutorial covers a production-ready install from a fresh Ubuntu 22.04 VPS through to a working HTTPS virtual host with automatic certificate renewal.
How to verify
After completing the install, confirm the correct state:
# OLS version and build
/usr/local/lsws/bin/lswsctrl status
/usr/local/lsws/bin/lshttpd -v 2>&1 | head -2
# Listeners (WebAdmin must NOT be on 0.0.0.0)
ss -lntp | grep -E ':(80|443|7080)\b'
# Config syntax check
/usr/local/lsws/bin/lswsctrl -t
# HTTPS response with LSCache header
curl -sI https://example.com/ | grep -iE 'server|x-litespeed|strict-transport'
# Let's Encrypt cert issuer and expiry
openssl s_client -connect example.com:443 -servername example.com \
</dev/null 2>/dev/null | openssl x509 -noout -issuer -dates
What’s happening
OpenLiteSpeed installs from LiteSpeed’s official APT repository. The package places the server binary at /usr/local/lsws/bin/lshttpd, the main config at /usr/local/lsws/conf/httpd_config.conf, and per-vhost configs under /usr/local/lsws/conf/vhosts/<name>/. The WebAdmin console — a separate process — listens on port 7080 over HTTPS using a self-signed certificate. It manages the server through a web UI that writes directly to the config files, which you can also edit by hand.
PHP is not bundled; you install LSPHP (LiteSpeed’s PHP build with the LSAPI transport) from the same repository. LSAPI is faster than PHP-FPM over a Unix socket for LiteSpeed because it avoids the CGI protocol overhead — the PHP worker communicates directly with the server module in-process. You attach LSPHP to a vhost by declaring an external processor of type lsapi and a script handler mapping .php to that processor.
Let’s Encrypt integration works via Certbot or acme.sh. The critical step most guides omit is the deploy hook: after Certbot renews the certificate, LiteSpeed must be told to reload — it does not poll the cert files. Without the hook, your cert renews on disk but the server keeps serving the old (eventually expired) cert from memory.
The procedure
1. Add the LiteSpeed APT repository and install.
sudo apt-get update
sudo apt-get install -y wget curl software-properties-common
wget -O /tmp/ols.sh https://repo.litespeed.sh
sudo bash /tmp/ols.sh
sudo apt-get update
sudo apt-get install -y openlitespeed lsphp82 lsphp82-common \
lsphp82-mysql lsphp82-opcache lsphp82-gd \
lsphp82-mbstring lsphp82-xml lsphp82-json
# Default PHP symlink
sudo ln -sf /usr/local/lsws/lsphp82/bin/lsphp \
/usr/local/lsws/fcgi-bin/lsphp
2. Harden the WebAdmin console.
By default the admin console listens on 0.0.0.0:7080. Bind it to localhost:
sudo sed -i 's|address.*7080|address 127.0.0.1:7080|g' \
/usr/local/lsws/admin/conf/admin_config.conf
Rotate the default admin password:
sudo /usr/local/lsws/admin/misc/admpass.sh
# Enter a strong password when prompted; username defaults to admin
3. Start and enable LiteSpeed.
sudo systemctl enable --now lsws
sudo systemctl status lsws
4. Configure a virtual host.
Create the document root and log directories:
sudo mkdir -p /var/www/example.com/{html,logs,cache}
sudo chown -R nobody:nogroup /var/www/example.com
Create the vhost config directory and file:
sudo mkdir -p /usr/local/lsws/conf/vhosts/example.com
sudo tee /usr/local/lsws/conf/vhosts/example.com/vhconf.conf > /dev/null <<'VHCONF'
docRoot /var/www/example.com/html
enableGzip 1
enableBr 1
errorlog /var/www/example.com/logs/error.log {
useServer 0
logLevel WARN
rollingSize 50M
}
accesslog /var/www/example.com/logs/access.log {
useServer 0
rollingSize 100M
keepDays 14
compressArchive 1
}
index {
useServer 0
indexFiles index.php, index.html
}
scripthandler {
add lsapi:lsphp82 php
}
extprocessor lsphp82 {
type lsapi
address uds://tmp/lshttpd/lsphp82.sock
maxConns 32
env LSAPI_CHILDREN=32
initTimeout 60
retryTimeout 0
persistConn 1
autoStart 1
path /usr/local/lsws/lsphp82/bin/lsphp
memSoftLimit 256M
memHardLimit 384M
}
context / {
location /var/www/example.com/html
allowBrowse 1
rewrite {
enable 1
autoLoadHtaccess 1
}
}
module cache {
storagePath /var/www/example.com/cache
}
rewrite {
enable 1
autoLoadHtaccess 1
}
VHCONF
Register the vhost and listeners in the main config:
sudo tee -a /usr/local/lsws/conf/httpd_config.conf > /dev/null <<'MAIN'
virtualhost example.com {
vhRoot /var/www/example.com
configFile $SERVER_ROOT/conf/vhosts/example.com/vhconf.conf
allowSymbolLink 1
enableScript 1
restrained 1
}
listener HTTP {
address *:80
secure 0
map example.com example.com
}
MAIN
5. Issue a Let’s Encrypt certificate and configure HTTPS.
sudo apt-get install -y certbot
# Stop OLS temporarily so certbot can bind port 80
sudo systemctl stop lsws
sudo certbot certonly --standalone -d example.com --non-interactive \
--agree-tos -m ops@example.com
sudo systemctl start lsws
Install the deploy hook so OLS reloads on renewal:
sudo tee /etc/letsencrypt/renewal-hooks/deploy/openlitespeed.sh > /dev/null <<'HOOK'
#!/bin/bash
touch /usr/local/lsws/conf/serial.no
systemctl reload lsws
HOOK
sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/openlitespeed.sh
Add the HTTPS listener to the main config:
sudo tee -a /usr/local/lsws/conf/httpd_config.conf > /dev/null <<'SSL'
listener HTTPS {
address *:443
secure 1
keyFile /etc/letsencrypt/live/example.com/privkey.pem
certFile /etc/letsencrypt/live/example.com/fullchain.pem
sslProtocol 24
enableECDHE 1
enableSpdy 15
map example.com example.com
}
SSL
Validate and restart:
sudo /usr/local/lsws/bin/lswsctrl -t
sudo systemctl restart lsws
6. Open firewall ports.
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
Common pitfalls
The WebAdmin console on 0.0.0.0:7080 is the single most common post-install security gap. SSH tunnel into it (ssh -L 7080:127.0.0.1:7080 user@host) rather than exposing it to the internet. Fail2ban or Cloudflare will not protect port 7080 if it is open and the admin credentials have not been rotated.
memHardLimit is a hard cap, not a soft suggestion. LSPHP workers that exceed memHardLimit are killed immediately. A WordPress site with WooCommerce, heavy plugins, and a large cart easily needs 384–512M. Monitor /var/log/syslog for OOM kills after launch.
Certbot standalone mode requires port 80 to be free during renewal. If OLS is running on port 80, the standalone renewal will fail. Use the --webroot authenticator instead after initial setup, pointing at /var/www/example.com/html — or switch to acme.sh with the --webroot mode, which does not need a port free.
The autoLoadHtaccess directive must be enabled per context block. If your WordPress .htaccess rewrite rules are not being applied, check that autoLoadHtaccess 1 is set inside the rewrite {} block of your context, not just at the vhost level.
Config changes via the WebAdmin console overwrite manual edits. If you edit vhconf.conf by hand and then save any setting in the WebAdmin for the same vhost, the console may regenerate the file and lose your edits. Pick one management path — WebAdmin or hand-edited files — and stick to it.
For Ubuntu-based OpenLiteSpeed deployments where you need ongoing certificate management, security patching, and PHP version lifecycle handled without manual intervention, see Stack Harbor’s managed operations.