CLI Quick Reference
Every command you will use operating OpenLiteSpeed from the terminal. No GUI required.
Service Control
# === GRACEFUL RELOAD (use this for config changes) ===
sudo /usr/local/lsws/bin/lswsctrl restart
# === FULL RESTART (drops connections — for binary upgrades) ===
sudo systemctl restart lsws
# Start / Stop
sudo systemctl start lsws
sudo systemctl stop lsws
# Status
sudo systemctl status lsws
sudo /usr/local/lsws/bin/lswsctrl status
# Enable / disable autostart
sudo systemctl enable lsws
sudo systemctl disable lsws
# Reload via signal (alternative graceful reload)
sudo kill -USR1 $(cat /tmp/lshttpd/lshttpd.pid)
Version & Build
/usr/local/lsws/bin/lshttpd -v
dpkg -l openlitespeed # Debian/Ubuntu
rpm -q openlitespeed # RHEL/AlmaLinux
Process Inspection
# Is lshttpd running?
ps aux | grep lshttpd | grep -v grep
# Worker count
ps aux | grep lshttpd | grep -v grep | wc -l
# lsphp worker count
ps aux | grep lsphp | grep -v grep | wc -l
# Listening ports
sudo ss -tlnp | grep lshttpd
# PID file
cat /tmp/lshttpd/lshttpd.pid
# Uptime
ps -p $(cat /tmp/lshttpd/lshttpd.pid) -o etime=
# Open file descriptors
sudo lsof -p $(cat /tmp/lshttpd/lshttpd.pid) | wc -l
Log Commands
# Live tail error log (most useful)
sudo tail -f /usr/local/lsws/logs/error.log
# Last N lines
sudo tail -50 /usr/local/lsws/logs/error.log
sudo tail -100 /usr/local/lsws/logs/error.log
# Filter errors and warnings
sudo grep -iE "error|warn|crit|fail" /usr/local/lsws/logs/error.log | tail -30
# Search for domain-specific issues
sudo grep "example.com" /usr/local/lsws/logs/error.log | tail -20
# Access log
sudo tail -f /usr/local/lsws/logs/access.log
# Restart history
cat /usr/local/lsws/logs/lsrestart.log
# Check PHP stderr
sudo tail -f /usr/local/lsws/logs/stderr.log
# Per-vhost log (if configured)
sudo tail -f /usr/local/lsws/conf/vhosts/<name>/logs/error.log
Config Management
# View main server config
sudo cat /usr/local/lsws/conf/httpd_config.conf
# Edit main config (vim)
sudo vim /usr/local/lsws/conf/httpd_config.conf
# View / edit a vhost config
sudo vim /usr/local/lsws/conf/vhosts/example/vhconf.conf
# List all vhost configs
find /usr/local/lsws/conf/vhosts -name "vhconf.conf" | sort
# Search directives across all configs
sudo grep -rn "docRoot\|phpIniOverride\|scriptHandler" /usr/local/lsws/conf/
# Check config syntax
sudo /usr/local/lsws/bin/lshttpd -t
# Diff before/after edit
sudo diff /usr/local/lsws/conf/httpd_config.conf.bak /usr/local/lsws/conf/httpd_config.conf
PHP / lsphp
# List installed PHP versions
ls /usr/local/lsws/ | grep lsphp
# PHP version
/usr/local/lsws/lsphp84/bin/lsphp -v
# Active php.ini path
/usr/local/lsws/lsphp84/bin/lsphp --ini | grep "Loaded Configuration"
# Edit php.ini
sudo vim /usr/local/lsws/lsphp84/etc/php/8.4/litespeed/php.ini
# Install more PHP extensions (Ubuntu)
sudo apt install lsphp84-redis lsphp84-imagick lsphp84-mbstring
# Check loaded PHP modules
/usr/local/lsws/lsphp84/bin/lsphp -m
# Run a PHP test
/usr/local/lsws/lsphp84/bin/lsphp -r "echo phpinfo();" | head -20
WebAdmin
# Reset admin password
sudo /usr/local/lsws/admin/misc/admpass.sh
# View admin password hash
sudo cat /usr/local/lsws/admin/conf/htpasswd
# Default WebAdmin URL
# https://your-server-ip:7080
# Check WebAdmin is responding
curl -k -I https://localhost:7080
SSL / TLS from CLI
# Test SSL handshake
openssl s_client -connect your-domain.com:443 -servername your-domain.com
# Check certificate expiry
openssl s_client -connect your-domain.com:443 2>/dev/null | openssl x509 -noout -dates
# View installed cert
sudo openssl x509 -in /etc/ssl/certs/your-cert.pem -noout -text | grep -E "Subject:|DNS:|Not After"
# Check cert file paths used in OLS config
grep -rn "keyFile\|certFile" /usr/local/lsws/conf/
Network Diagnostics
# Count active HTTPS connections
sudo ss -tn state established '( dport = :443 )' | wc -l
# All OLS connections
sudo ss -tnp | grep lshttpd | head -20
# Test response time
curl -w "TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" -o /dev/null -s http://localhost/
# Test with specific Host header
curl -H "Host: example.com" -I http://localhost/
# Check DNS resolution from server
dig +short example.com
nslookup example.com
Filesystem Permissions (Common Fixes)
# Fix web root ownership (OLS runs as nobody:nogroup by default)
sudo chown -R nobody:nogroup /var/www/example.com/
sudo chmod -R 755 /var/www/example.com/
# Fix only file permissions (not dirs)
find /var/www/example.com -type f -exec chmod 644 {} \;
# Fix only directory permissions
find /var/www/example.com -type d -exec chmod 755 {} \;
# Check what user OLS runs as
ps aux | grep lshttpd | grep -v grep | awk '{print $1}' | head -3
grep "RunAs\|runAs" /usr/local/lsws/conf/httpd_config.conf
One-Line Health Check
echo "OLS: $(systemctl is-active lsws) | $(/usr/local/lsws/bin/lshttpd -v 2>&1 | head -1) | Workers: $(ps aux | grep lshttpd | grep -v grep | wc -l) | PHP: $(ps aux | grep lsphp | grep -v grep | wc -l) | Last error: $(sudo tail -1 /usr/local/lsws/logs/error.log)"
Package Management
# Update OLS (Debian/Ubuntu)
sudo apt update && sudo apt upgrade openlitespeed
# Update OLS (RHEL/AlmaLinux)
sudo dnf update openlitespeed
# Check available lsphp versions
apt search lsphp | grep "^lsphp" # Debian
dnf search lsphp # RHEL
# Remove old PHP version
sudo apt remove lsphp82 lsphp82-common