CLI Management
OpenLiteSpeed is fully manageable from the command line. You do not need the WebAdmin GUI for day-to-day operations. This page covers every CLI operation you will use regularly.
tmux Workflow
In tmux, keep your error log tailing in one pane and your command input in another:
# Pane 1: live error log
sudo tail -f /usr/local/lsws/logs/error.log
# Pane 2: run your commands here
Split: Ctrl+b % (vertical) or Ctrl+b " (horizontal)
Service Control
These are the commands you will run most often.
# --- GRACEFUL RELOAD (preferred for config changes) ---
# Applies new config without dropping active connections
sudo /usr/local/lsws/bin/lswsctrl restart
# --- FULL STOP / START ---
sudo systemctl stop lsws
sudo systemctl start lsws
sudo systemctl restart lsws # stop + start (drops connections)
# --- STATUS ---
sudo systemctl status lsws
sudo /usr/local/lsws/bin/lswsctrl status
# --- ENABLE AUTO-START ON BOOT ---
sudo systemctl enable lsws
sudo systemctl disable lsws # remove from boot
# --- SEND RELOAD SIGNAL DIRECTLY (alternative) ---
sudo kill -USR1 $(cat /tmp/lshttpd/lshttpd.pid)
When to Use Which
| Situation | Command |
|---|---|
| Config file edited (vhost, listener, handler) | lswsctrl restart |
Binary upgraded (apt upgrade openlitespeed) | systemctl restart lsws |
PHP ini changed (php.ini, opcache) | lswsctrl restart |
| Worker process appears stuck | systemctl restart lsws |
| Testing graceful reload with no disruption | lswsctrl restart |
Version and Build Info
# Full version string
/usr/local/lsws/bin/lshttpd -v
# Short version check
/usr/local/lsws/bin/lshttpd -v 2>&1 | head -1
# Check installed OLS package version (Debian/Ubuntu)
dpkg -l openlitespeed
# Check on RHEL-family
rpm -q openlitespeed
Process Inspection
# Is lshttpd running?
ps aux | grep lshttpd | grep -v grep
# How many worker processes?
ps aux | grep lshttpd | grep -v grep | wc -l
# What ports is OLS listening on?
sudo ss -tlnp | grep lshttpd
# What files does the main process have open?
sudo lsof -p $(cat /tmp/lshttpd/lshttpd.pid) | head -30
# How long has OLS been running (uptime)?
ps -p $(cat /tmp/lshttpd/lshttpd.pid) -o etime=
# PID file location
cat /tmp/lshttpd/lshttpd.pid
Log Access
# Live tail error log (most important)
sudo tail -f /usr/local/lsws/logs/error.log
# Last 50 lines of error log
sudo tail -50 /usr/local/lsws/logs/error.log
# Search error log for specific issues
sudo grep -i "error\|warn\|fail" /usr/local/lsws/logs/error.log | tail -30
# Search for a specific domain's errors
sudo grep "example.com" /usr/local/lsws/logs/error.log | tail -20
# Check restart history
sudo tail -20 /usr/local/lsws/logs/lsrestart.log
# Check access log (if enabled at server level)
sudo tail -f /usr/local/lsws/logs/access.log
# Virtual host specific logs (if configured per-vhost)
sudo tail -f /usr/local/lsws/conf/vhosts/example/logs/error.log
Config Management (No WebAdmin)
# View main server config
sudo cat /usr/local/lsws/conf/httpd_config.conf
# Edit main server config directly
sudo vim /usr/local/lsws/conf/httpd_config.conf
# Edit a virtual host config
sudo vim /usr/local/lsws/conf/vhosts/example/vhconf.conf
# List all virtual host configs
find /usr/local/lsws/conf/vhosts -name "vhconf.conf" | sort
# Search for a specific directive across all configs
sudo grep -rn "docRoot\|phpIniOverride\|scriptHandler" /usr/local/lsws/conf/
# Validate config syntax (check error log after running)
sudo /usr/local/lsws/bin/lshttpd -t
After Editing Config Directly
Always run sudo /usr/local/lsws/bin/lswsctrl restart after direct config edits.
Check the error log immediately: sudo tail -20 /usr/local/lsws/logs/error.log
PHP / lsphp Management
# List all installed lsphp versions
ls /usr/local/lsws/ | grep lsphp
# Check PHP version
/usr/local/lsws/lsphp84/bin/lsphp -v
# How many lsphp workers are running?
ps aux | grep lsphp | grep -v grep | wc -l
# Which php.ini is loaded?
/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 a new lsphp version (Debian/Ubuntu)
sudo apt install lsphp83 lsphp83-common lsphp83-mysql
# Install additional PHP extensions
sudo apt install lsphp84-redis lsphp84-imagick lsphp84-mbstring
WebAdmin Password Reset
# Reset WebAdmin admin password (interactive prompt)
sudo /usr/local/lsws/admin/misc/admpass.sh
# View hashed password file
sudo cat /usr/local/lsws/admin/conf/htpasswd
Connection and Network Diagnostics
# Active connections by port
sudo ss -s
# Connections to port 443
sudo ss -tn state established '( dport = :443 or sport = :443 )' | wc -l
# Test your site from localhost
curl -I http://localhost
curl -I https://localhost --insecure
curl -H "Host: example.com" http://localhost/
# Test with full response timing
curl -w "\n--- Timing ---\nConnect: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n" \
-o /dev/null -s http://localhost/
# Check SSL certificate from CLI
openssl s_client -connect localhost:443 -servername example.com 2>/dev/null | \
openssl x509 -noout -dates -subject
Quick Health Check One-Liner
echo "=== OLS Health ===" && \
/usr/local/lsws/bin/lshttpd -v 2>&1 | head -1 && \
echo "Service: $(systemctl is-active lsws)" && \
echo "Workers: $(ps aux | grep lshttpd | grep -v grep | wc -l) lshttpd" && \
echo "PHP workers: $(ps aux | grep lsphp | grep -v grep | wc -l) lsphp" && \
echo "Ports: $(sudo ss -tlnp | grep lshttpd | awk '{print $4}' | tr '\n' ' ')" && \
echo "Last error: $(sudo tail -1 /usr/local/lsws/logs/error.log)"
AI-Assisted Debugging with opencode
If you use opencode at the server level, you can pipe logs directly into it for analysis:
# Pipe last 100 error log lines into opencode for analysis
sudo tail -100 /usr/local/lsws/logs/error.log | opencode "analyze these OpenLiteSpeed errors and suggest fixes"
# Ask opencode to help write a vhost config
opencode "write an OpenLiteSpeed vhconf.conf for a WordPress site at /var/www/example.com/public with lsphp84"
# Get opencode to review your config file
cat /usr/local/lsws/conf/vhosts/example/vhconf.conf | opencode "review this OLS vhost config for issues"
opencode + tmux Workflow
- Open your config in vim in pane 1
- In pane 2, run
opencodeand ask questions about the config - Apply changes, then do
lswsctrl restartand check the log in pane 3
What's Next
- Script Automation — Build reusable bash scripts for common OLS tasks
- Configuration Backup — Automated backup scripts with cron