OLS Virtual Host Configuration
Understanding OLS Virtual Host Configuration
Each website on BlitzPress has its own virtual host (vhost) configuration. Understanding the vhost structure is essential for advanced customization.
File Locations
# Main OLS config
/usr/local/lsws/conf/httpd_config.conf
# Per-site vhost config
/usr/local/lsws/conf/vhosts/YOUR_DOMAIN/vhconf.conf
# Listener config (maps domains to vhosts)
# Defined in httpd_config.conf
vhconf.conf Structure
A typical BlitzPress vhost configuration:
docRoot /home/YOUR_DOMAIN/public_html/
index {
useServer 0
indexFiles index.php, index.html
}
scripthandler {
add lsapi:lsphp /usr/local/lsws/lsphp82/bin/lsphp
}
extprocessor lsphp {
type lsapi
address uds://tmp/lshttpd/lsphp_YOUR_DOMAIN.sock
maxConns 20
env PHP_LSAPI_CHILDREN=20
env LSAPI_AVOID_FORK=200M
initTimeout 60
retryTimeout 0
respBuffer 0
}
rewrite {
enable 1
autoLoadHtaccess 1
}
vhssl {
keyFile /root/.acme.sh/YOUR_DOMAIN/YOUR_DOMAIN.key
certFile /root/.acme.sh/YOUR_DOMAIN/fullchain.cer
}
Key Directives
| Directive | Purpose |
|---|---|
| docRoot | Document root for the site |
| scripthandler | Maps PHP files to the lsphp processor |
| extprocessor | Defines the PHP backend (lsphp) settings |
| maxConns | Maximum concurrent PHP connections |
| PHP_LSAPI_CHILDREN | Number of PHP worker processes |
| vhssl | SSL certificate and key paths |
Listener Configuration
Listeners map incoming requests to vhosts. In httpd_config.conf:
listener HTTP {
address *:80
map YOUR_DOMAIN YOUR_DOMAIN, www.YOUR_DOMAIN
}
listener HTTPS {
address *:443
secure 1
map YOUR_DOMAIN YOUR_DOMAIN, www.YOUR_DOMAIN
}
Adding a New Context
Contexts define behavior for specific URL paths:
context /api {
location /home/YOUR_DOMAIN/public_html/api/
allowBrowse 1
extraHeaders <<<END_extraHeaders
Header set Access-Control-Allow-Origin "*"
END_extraHeaders
}
After Changes
sudo systemctl restart lsws
Always test your configuration before restarting in production. Back up vhconf.conf before making changes.