Configuration Testing
By the end of this lesson you will know how to validate OpenLiteSpeed configuration before reloading, catch common syntax and path errors, and build a pre-reload checklist.
Why Test Before Reloading
Most configuration incidents come from small mismatches that simple validation could catch. A missing file path, a wrong permission, or a broken external app reference can take a production site down during a reload.
Pre-Reload Checklist
Run through this checklist before every reload:
| Check | Command / Action | What to Look For |
|---|---|---|
| Config syntax | Review WebAdmin for save errors | Red warnings or error banners |
| File paths exist | ls -la /path/to/cert.pem | File not found errors |
| Permissions correct | stat /usr/local/lsws/conf/httpd_config.conf | Ownership by lsadm or nobody |
| External app reachable | ls -la /usr/local/lsws/lsphp84/bin/lsphp | Binary exists and is executable |
| Certificate valid | openssl x509 -in cert.pem -noout -dates | Not expired, correct hostname |
| Document root exists | ls -la /var/www/example.com/public/ | Directory exists with correct permissions |
Validating Config File Syntax
OpenLiteSpeed does not have a standalone configtest command like Apache. Instead, use these methods:
Method 1: WebAdmin Save Validation
When you save changes through WebAdmin, it performs basic validation. If there are syntax errors, the save dialog shows warnings.
Method 2: Check Logs After Reload
# Perform a graceful reload
sudo /usr/local/lsws/bin/lswsctrl restart
# Immediately check the error log
tail -50 /usr/local/lsws/logs/error.log
Look for lines containing [ERROR], [WARNING], or failed to patterns.
Method 3: Manual File Review
# Inspect the main config
cat /usr/local/lsws/conf/httpd_config.conf | head -100
# Inspect a virtual host config
cat /usr/local/lsws/conf/vhosts/example/vhconf.conf
Common Config Errors and How to Spot Them
| Error | Symptom | How to Check |
|---|---|---|
| Wrong certificate path | SSL listener fails, 525 errors | ls -la /path/to/cert.pem /path/to/key.pem |
| Missing document root | 404 or 403 for all pages | ls -la $VH_ROOT/html/ |
| Wrong lsphp binary path | 503 errors on PHP pages | ls -la /usr/local/lsws/lsphp84/bin/lsphp |
| Permission denied on socket | PHP connection refused | ls -la /tmp/lshttpd/ |
| Domain not mapped to vhost | Default page shown instead | Check listener → virtual host mapping in WebAdmin |
Building a Testing Habit
#!/bin/bash
# Quick pre-reload validation script
echo "=== Checking OpenLiteSpeed config ==="
# Check main config file exists
if [ ! -f /usr/local/lsws/conf/httpd_config.conf ]; then
echo "ERROR: Main config file missing!"
exit 1
fi
# Check lsphp binary
if [ ! -x /usr/local/lsws/lsphp84/bin/lsphp ]; then
echo "WARNING: lsphp84 binary not found or not executable"
fi
# Check certificate files (adjust paths)
for cert in /etc/ssl/private/*.pem; do
if [ -f "$cert" ]; then
openssl x509 -in "$cert" -noout -checkend 86400 2>/dev/null
if [ $? -ne 0 ]; then
echo "WARNING: Certificate $cert expires within 24 hours"
fi
fi
done
# Check log permissions
if [ ! -w /usr/local/lsws/logs/ ]; then
echo "WARNING: Log directory not writable"
fi
echo "=== Checks complete ==="
Do not skip validation even for small changes. A single-character typo in a path can cause site-wide outages.
Key Takeaways
- Most config incidents come from small mismatches that simple validation could catch.
- Use WebAdmin save validation, log checks, and manual file review as your testing layers.
- Build a pre-reload checklist and make it a habit before every change.
- Document your config paths so you can validate them quickly under pressure.
What's Next
- Continue to Common Errors to learn how to diagnose
403,500, and permission issues.