| Server IP : 202.155.9.250 / Your IP : 216.73.217.177 Web Server : LiteSpeed System : Linux srv339029361 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64 User : grabn6394 ( 1016) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/local/lsws/docs/ |
Upload File : |
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>OpenLiteSpeed Users' Manual - Virtual Host Templates</title>
<meta name="description" content="OpenLiteSpeed Users' Manual - Virtual Host Templates." />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex">
<script>
(function () {
var theme = 'light';
var resolved = false;
try {
if (window.localStorage) {
var storedTheme = window.localStorage.getItem('hdoc.theme');
if (storedTheme === 'light' || storedTheme === 'dark') {
theme = storedTheme;
resolved = true;
}
}
} catch (err) {
}
if (!resolved && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'dark';
}
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.style.colorScheme = theme;
}());
</script>
<link rel="shortcut icon" href="img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/hdoc.css">
<link rel="stylesheet" type="text/css" href="css/hdoc-product-accent.css">
<script src="hdoc-search-index.js" defer></script>
<script src="js/hdoc-search.js" defer></script>
</head>
<body>
<div class="doc-shell">
<header class="doc-topbar">
<a class="doc-brand" href="index.html" aria-label="OpenLiteSpeed Users' Manual">
<img src="img/ols_logo.svg" alt="OpenLiteSpeed logo" />
<strong>OpenLiteSpeed Users' Manual</strong>
</a>
<div class="doc-actions">
<button class="doc-menu-toggle" type="button" aria-label="Open menu" data-menu-toggle aria-expanded="false">
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 12h18M3 6h18M3 18h18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
</button>
<form class="doc-search" role="search" data-empty="Search pages and settings" data-no-results="No results found.">
<label class="sr-only" for="doc-search-input">Search the manual</label>
<div class="doc-search__box">
<input id="doc-search-input" type="search" autocomplete="off" placeholder="Search pages and settings" aria-controls="doc-search-results" />
<button type="submit">Search</button>
</div>
<div id="doc-search-results" class="doc-search__results" hidden></div>
</form>
</div>
<label class="doc-language"><select id="doc-language-switcher" name="doc_language" data-language-switcher aria-label="Language"><option value="Templates_Help.html" data-lang="en-US" selected>English</option><option value="es-ES/Templates_Help.html" data-lang="es-ES">Español</option><option value="de-DE/Templates_Help.html" data-lang="de-DE">Deutsch</option><option value="fr-FR/Templates_Help.html" data-lang="fr-FR">Français</option><option value="zh-CN/Templates_Help.html" data-lang="zh-CN">简体中文</option><option value="ja-JP/Templates_Help.html" data-lang="ja-JP">日本語</option></select></label>
<button class="doc-theme-toggle" type="button" aria-label="Toggle theme" data-theme-toggle data-theme-light-label="Light mode" data-theme-dark-label="Dark mode" title="Toggle theme">
<span class="doc-theme-toggle__icon" aria-hidden="true"></span>
</button>
</header>
<div class="doc-menu-backdrop" data-menu-backdrop></div>
<div class="pagewrapper" data-current-lang="en-US" data-supported-langs="["en-US","es-ES","de-DE","fr-FR","zh-CN","ja-JP"]"><aside class="sidetree"><div class="sidetree__masthead"><figure class="sidetree__figure"><img src="img/ols_logo.svg" alt="OpenLiteSpeed logo" /></figure><div class="sidetree__identity"><a class="sidetree__manual-link" href="index.html">Users' Manual</a><div class="sidetree__version">Version 1.9 — Rev. 4</div></div></div><nav class="sidetree__nav" aria-label="Table of Contents"><ul class="sidetree__list">
<li><a href="license.html">License</a></li>
<li><a href="intro.html">Introduction</a></li>
<li><a href="install.html">Installation/Uninstallation</a></li>
<li>
<a href="admin.html">Administration</a>
<ul class="level2">
<li><a href="ServerStat_Help.html">Service Manager</a></li>
<li><a href="Real_Time_Stats_Help.html">Real-Time Stats</a></li>
</ul>
</li>
<li><a href="security.html">Security</a></li>
<li>
<a href="config.html">Configuration</a>
<ul class="level2">
<li><a href="ServGeneral_Help.html">Server General</a></li>
<li><a href="ServLog_Help.html">Server Log</a></li>
<li><a href="ServTuning_Help.html">Server Tuning</a></li>
<li><a href="ServSecurity_Help.html">Server Security</a></li>
<li>
<a href="ExtApp_Help.html">External Apps</a>
<ul class="level3">
<li><a href="External_LSAPI.html">LSAPI App</a></li>
<li><a href="External_WS.html">Web Server (Proxy)</a></li>
<li><a href="External_FCGI.html">Fast CGI App</a></li>
<li><a href="External_FCGI_Auth.html">Fast CGI Authorizer</a></li>
<li><a href="External_SCGI.html">Simple CGI App</a></li>
<li><a href="External_Servlet.html">Servlet Engine</a></li>
<li><a href="External_PL.html">Piped Logger</a></li>
<li><a href="External_LB.html">Load Balancer</a></li>
<li><a href="External_UWSGI.html">uWSGI</a></li>
</ul>
</li>
<li><a href="ScriptHandler_Help.html">Script Handler</a></li>
<li><a href="App_Server_Help.html">App Server Settings</a></li>
<li><a href="Module_Help.html">Module Configuration</a></li>
<li><a href="Listeners_General_Help.html">Listener General</a></li>
<li><a href="Listeners_SSL_Help.html">Listener SSL</a></li>
<li><a class="current" href="Templates_Help.html">Virtual Host Templates</a></li>
<li><a href="VirtualHosts_Help.html">Virtual Host Registration</a></li>
<li><a href="VHGeneral_Help.html">Virtual Host General</a></li>
<li><a href="VHSecurity_Help.html">Virtual Host Security</a></li>
<li><a href="VHSSL_Help.html">Virtual Host SSL</a></li>
<li><a href="Rewrite_Help.html">Rewrite</a></li>
<li>
<a href="Context_Help.html">Context</a>
<ul class="level3">
<li><a href="Static_Context.html">Static Context</a></li>
<li><a href="Java_Web_App_Context.html">Java Web App Context</a></li>
<li><a href="Servlet_Context.html">Servlet Context</a></li>
<li><a href="FCGI_Context.html">Fast CGI Context</a></li>
<li><a href="SCGI_Context.html">Simple CGI Context</a></li>
<li><a href="LSAPI_Context.html">LSAPI Context</a></li>
<li><a href="Proxy_Context.html">Proxy Context</a></li>
<li><a href="CGI_Context.html">CGI Context</a></li>
<li><a href="LB_Context.html">Load Balancer Context</a></li>
<li><a href="Redirect_Context.html">Redirect Context</a></li>
<li><a href="App_Server_Context.html">App Server Context</a></li>
<li><a href="UWSGI_Context.html">uWSGI Context</a></li>
<li><a href="Module_Context.html">Module Handler Context</a></li>
</ul>
</li>
<li><a href="VHWebSocket_Help.html">Web Socket Proxy</a></li>
</ul>
</li>
<li><a href="webconsole.html">Web Console</a>
<ul class="level2">
<li><a href="AdminGeneral_Help.html">Admin Console General</a></li>
<li><a href="AdminSecurity_Help.html">Admin Console Security</a></li>
<li><a href="AdminListeners_General_Help.html">Admin Listener General</a></li>
<li><a href="AdminListeners_SSL_Help.html">Admin Listener SSL</a></li>
</ul>
</li>
</ul></nav></aside><article class="contentwrapper"><div class="nav-bar"><div class="prev">« <a href="Listeners_SSL_Help.html">Listeners SSL</a></div><div class="center"><a href="config.html">Configuration</a></div><div class="next"><a href="VirtualHosts_Help.html">Virtual Host Registration</a> »</div></div>
<header class="doc-page-header"><h1>Virtual Host Templates</h1><div class="doc-page-intro">Virtual host templates make it easy to create many new virtual hosts with similar configurations.<br/><br/> Each template contains a template configuration file, a list of mapped listeners, and a list of member virtual hosts.<br/><br/> To add a template-based virtual host, the administrator only needs to add a member with a unique virtual host name and a qualified domain name to the template member list. Listener-to-virtual host mapping will be added automatically for all listeners in the template's mapped listener list.<br/><br/> Later on, if you need to customize the configuration for a particular virtual host, just "instantiate" that member virtual host and a standalone virtual host configuration will be created automatically. Even when setting up a customized virtual host, a template can still be a convenient starting point.</div>
</header><section class="doc-toc" aria-labelledby="top"><header class="doc-toc__header"><h2 id="top">Table of Contents</h2></header><section class="doc-toc__row"><h3 class="doc-toc__heading">Template Location</h3><ul class="doc-toc__links"><li><a href="#templateName">Template Name</a></li><li><a href="#templateFile">Template File</a></li><li><a href="#mappedListeners">Mapped Listeners</a></li></ul></section>
<section class="doc-toc__row"><h3 class="doc-toc__heading">Member Virtual Hosts</h3><ul class="doc-toc__links"><li><a href="#templateVHName">Virtual Host Name</a></li><li><a href="#templateVHDomain">Domain Name</a></li><li><a href="#templateVHAliases">Domain Aliases</a></li><li><a href="#memberVHRoot">Member Virtual Host Root</a></li></ul></section>
<section class="doc-toc__row"><h3 class="doc-toc__heading">Template Settings</h3><ul class="doc-toc__links"><li><a href="#templateVHRoot">Default Virtual Host Root</a></li><li><a href="#templateVHConfigFile">Instantiated VHost Config File</a></li><li><a href="#templateVHDocRoot">Document Root</a></li><li><a href="#tp_vhFileName">File Name Used in Template</a></li></ul></section>
</section>
<section class="doc-content-flow"><div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="templateName"><h3>Template Name<span class="ls-permlink"><a href="#templateName"></a></span></h3></header><h4>Description</h4><p>A unique name for the template.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="templateFile"><h3>Template File<span class="ls-permlink"><a href="#templateFile"></a></span></h3></header><h4>Description</h4><p>Specifies the path to the configuration file of this template. The file must be located within $SERVER_ROOT/conf/templates/ with a ".conf" filename. If the file you designate does not exist, after trying to save the template an error will appear with the link "CLICK TO CREATE". This link will generate a new empty template file. When you delete the template, the entry will be removed from your configurations, but the actual template config file will not be deleted.</p> <h4>Syntax</h4><p>path</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="mappedListeners"><h3>Mapped Listeners<span class="ls-permlink"><a href="#mappedListeners"></a></span></h3></header><h4>Description</h4><p>Specifies the names of all listeners that this template maps to. A listener-to-virtual host mapping for this template's member virtual hosts will be added to the listeners specified in this field. This mapping will map listeners to virtual hosts based on the domain names and aliases set in the member virtual hosts' individual configurations.</p> <h4>Syntax</h4><p>comma-separated list</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="templateVHName"><h3>Virtual Host Name<span class="ls-permlink"><a href="#templateVHName"></a></span></h3></header><h4>Description</h4><p>A unique name for this virtual host. This name must be unique among all template member virtual hosts and standalone virtual hosts. Inside a directory path configuration, this name can be referenced by the variable <span class="val">$VH_NAME</span>.<br/><br/> If a standalone virtual host with the same name is also configured, then the member virtual host configuration will be ignored.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="templateVHDomain"><h3>Domain Name<span class="ls-permlink"><a href="#templateVHDomain"></a></span></h3></header><h4>Description</h4><p>Specifies the main domain name for this member virtual host. If left blank, the virtual host name will be used. This should be a fully qualified domain name, but you can use an IP address as well. It is recommended to append <span class="val">:<port></span> for web sites not on port 80. For configurations containing domain names, this domain can be referenced with variable <span class="val">$VH_DOMAIN</span>.<br/><br/> This domain name will be used in the following situations: <ol> <li>To match the hostname in the Host header when processing a request.</li> <li>To populate domain name configurations for add-ons like FrontPage or AWstats.</li> <li>To configure listener-to-virtual host mappings based on the virtual host template.</li> </ol></p> <h4>Syntax</h4><p>domain name</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="templateVHAliases"><h3>Domain Aliases<span class="ls-permlink"><a href="#templateVHAliases"></a></span></h3></header><h4>Description</h4><p>Specifies alternate names for the virtual host. All possible hostnames and IP addresses should be added to this list. The wildcard characters <span class="val">*</span> and <span class="val">?</span> are allowed in the name. Append <span class="val">:<port></span> for web sites not on port 80.<br/><br/> Aliases will be used in the following situations: <ol> <li>To match the hostname in the Host header when processing a request.</li> <li>To populate domain name/alias configurations for add-ons like FrontPage or AWstats.</li> <li>To configure listener-to-virtual host mappings based on the virtual host template.</li> </ol></p> <h4>Syntax</h4><p>Comma-separated list of domain names.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="memberVHRoot"><h3>Member Virtual Host Root<span class="ls-permlink"><a href="#memberVHRoot"></a></span></h3></header><h4>Description</h4><p>Specifies the root directory of this virtual host. If left blank, the default virtual host root for this template will be used.<br/><br/> Note: This is <b>NOT</b> the document root. It is recommended to place all files related to the virtual host (like virtual host configuration, log files, html files, CGI scripts, etc.) under this directory. Virtual host root can be referred to as $VH_ROOT.</p> <h4>Syntax</h4><p>path</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="templateVHRoot"><h3>Default Virtual Host Root<span class="ls-permlink"><a href="#templateVHRoot"></a></span></h3></header><h4>Description</h4><p>Specifies the default root directory for member virtual hosts using this template. Variable <span class="val">$VH_NAME</span> must appear in the path. This will allow each member template to be automatically assigned a separate root directory based on its name.</p> <h4>Syntax</h4><p>path</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="templateVHConfigFile"><h3>Instantiated VHost Config File<span class="ls-permlink"><a href="#templateVHConfigFile"></a></span></h3></header><h4>Description</h4><p>Specifies the location of the config file generated when you instantiate a member virtual host. Variable <span class="val">$VH_NAME</span> must appear in the path so each virtual host will have its own file. Must be located under $SERVER_ROOT/conf/vhosts/. This config file will be created only after you move a member vhost out of the template through instantiation.</p> <h4>Syntax</h4><p>String with $VH_NAME variable and .conf suffix</p> <h4>Tips</h4><p><span class="ls-badge ls-badge--info">Information</span> $VH_NAME/vhconf.conf is recommended for easy management.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="templateVHDocRoot"><h3>Document Root<span class="ls-permlink"><a href="#templateVHDocRoot"></a></span></h3></header><h4>Description</h4><p>Specifies the unique path for each member virtual host's document root. Variable <span class="val">$VH_NAME</span> or <span class="val">$VH_ROOT</span> must appear in the path so each member virtual host will have its own document root.</p> <h4>Syntax</h4><p>path with $VH_NAME or $VH_ROOT variable</p> <h4>Example</h4><div class="ls-example">$VH_ROOT/public_html/ or $SERVER_ROOT/$VH_NAME/public_html.</div></article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="tp_vhFileName"><h3>File Name Used in Template<span class="ls-permlink"><a href="#tp_vhFileName"></a></span></h3></header><h4>Description</h4><p>Specifies a file path used by template-based virtual host settings. Variable <span class="val">$VH_NAME</span> or <span class="val">$VH_ROOT</span> must appear in the path so each member virtual host resolves to its own file. This setting is for template-owned files such as log files, not for the instantiated virtual host config file.</p> <h4>Syntax</h4><p>path with $VH_NAME or $VH_ROOT variable</p> </article> </div>
</section>
</article></div><button class="doc-back-to-top" type="button" aria-label="Back to top" data-back-to-top><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 19V5" /><path d="m6 11 6-6 6 6" /></svg><span class="sr-only">Back to top</span></button><footer class="copyright">Copyright © 2013-2026. <a href="https://www.litespeedtech.com">LiteSpeed Technologies Inc.</a> All rights reserved.</footer>
</div>
</body>
</html>