Skip to main content

vhconf.conf

Learning Focus

By the end of this lesson you will understand the purpose and structure of vhconf.conf, how it relates to the main config, and how to edit it safely for individual sites.

What It Is

vhconf.conf is the per-virtual-host configuration file. Each virtual host in OpenLiteSpeed has its own vhconf.conf that defines site-specific settings such as document root, rewrite rules, contexts, external apps, and script handlers.

Default location pattern:

/usr/local/lsws/conf/vhosts/<VHOST_NAME>/vhconf.conf

How It Relates to httpd_config.conf

The main httpd_config.conf references each virtual host by name. OpenLiteSpeed then reads the corresponding vhconf.conf for site-specific behavior.

Key Sections

SectionWhat It Controls
docRootPath to the public web files
indexDefault index files (e.g., index.html, index.php)
rewriteURL rewriting rules
contextPath-based handlers (static, PHP, proxy, redirect)
extprocessorExternal application definitions (e.g., lsphp)
scripthandlerMaps file extensions to external apps
accessLogPer-vhost access log settings

Working with vhconf.conf

Viewing

# List all virtual host configs
ls -la /usr/local/lsws/conf/vhosts/

# View a specific vhost config
cat /usr/local/lsws/conf/vhosts/example/vhconf.conf

Editing

# Backup first
sudo cp /usr/local/lsws/conf/vhosts/example/vhconf.conf \
/usr/local/lsws/conf/vhosts/example/vhconf.conf.bak

# Edit
sudo nano /usr/local/lsws/conf/vhosts/example/vhconf.conf

# Reload
sudo /usr/local/lsws/bin/lswsctrl restart

# Verify
tail -20 /usr/local/lsws/logs/error.log
info

Changes to vhconf.conf require a graceful reload to take effect. You do not need a full server restart.

Key Takeaways

  • Each site gets its own vhconf.conf for isolated, per-site configuration.
  • The file controls document root, rewrites, contexts, and PHP handler mappings.
  • Always backup before editing and reload after changes.

What's Next