On this page
An OpenLiteSpeed virtual host lets you host a website or application with its own document root, configuration, and domain mapping on a single server. With name-based virtual hosting, you can run multiple websites on the same IP address while directing each domain to the correct website files.
To configure an OpenLiteSpeed virtual host, you need to create the virtual host, set its document root, map its domain to an HTTP or HTTPS listener, and configure DNS. If the website uses HTTPS, you must also configure the appropriate SSL certificate. These settings work together to route visitors to the correct website.
What Is an OpenLiteSpeed Virtual Host?
An OpenLiteSpeed virtual host, often called a vhost, is a configuration that defines how OpenLiteSpeed serves a particular website or application.
Each virtual host can have its own document root, rewrite rules, log files, script settings, and domain configuration. This makes it possible to host several websites without running a separate web server instance for every domain.
For example, one server could host:
| Domain | Document root | Purpose |
|---|---|---|
example.com | /var/www/example/html | Main business website |
shop.example.net | /var/www/shop/html | Online store |
blog.example.org | /var/www/blog/html | Content website |
These paths are illustrative. The actual document roots depend on your operating system, installation method, and hosting configuration.
OpenLiteSpeed uses virtual hosts even when only one website is hosted. Unlike a setup that relies on a single default website configuration, each site is defined through its own virtual host and associated settings.
For official configuration details, see the OpenLiteSpeed virtual host documentation.
How Does OpenLiteSpeed Virtual Hosting Work?
OpenLiteSpeed uses listeners and virtual host mappings to direct incoming requests to the correct website.
A listener accepts connections on a specific IP address and port. A virtual host mapping associates a domain name with the virtual host that should handle requests for that domain.
When someone visits a website, the process works as follows:
- DNS resolves the domain. The domain’s DNS record points the visitor to the server’s IP address.
- The listener accepts the connection. OpenLiteSpeed receives the request on the relevant port, commonly port 80 for HTTP or port 443 for HTTPS.
- The server identifies the domain. OpenLiteSpeed uses the request’s hostname and the listener’s virtual host mappings to find the correct configuration.
- The virtual host processes the request. The server serves files from the configured document root or executes the relevant application.
- The response returns to the visitor. OpenLiteSpeed sends the website content through the established connection.
For HTTPS, TLS configuration must also be correct. OpenLiteSpeed supports Server Name Indication (SNI), which allows different virtual hosts to use their own certificates when configured appropriately.
What Do You Need Before Creating a Virtual Host?
Before configuring a new OpenLiteSpeed virtual host, check the following requirements.
- A working OpenLiteSpeed installation: Confirm that the web server is running and that you can access its WebAdmin Console.
- A registered domain: Use a domain you control, such as
example.com. - DNS access: You need permission to create or update the domain’s DNS records.
- A document root: Decide where the website’s files will be stored.
- Correct ownership and permissions: OpenLiteSpeed and the relevant application must have the access they need without exposing files unnecessarily.
- SSL certificate, if using HTTPS: Obtain a valid certificate for the domain and its required aliases.
- Administrative access: Direct configuration generally requires server or WebAdmin privileges.
If you manage websites through CyberPanel, you can usually create the website through its interface instead of manually building the virtual host configuration. The appropriate method depends on how OpenLiteSpeed was installed and whether a hosting panel manages its configuration.
How to Create an OpenLiteSpeed Virtual Host
The following example demonstrates a standalone OpenLiteSpeed configuration for example.com. It assumes OpenLiteSpeed is installed under /usr/local/lsws and that you are configuring the server directly rather than through a hosting panel.
Important: If CyberPanel or another control panel manages the server, do not blindly apply these manual steps to its live configuration. The panel may generate and maintain virtual host files automatically.
Step 1: Point the Domain to Your Server
Open your domain registrar or DNS provider and create an A record pointing the domain to your server’s public IPv4 address.
For example:
| Type | Name | Value |
|---|---|---|
| A | @ | 203.0.113.10 |
| A | www | 203.0.113.10 |
The IP address shown is a documentation example, not an address to use for your actual server. Replace it with your server’s public IP.
If your server uses IPv6, configure an appropriate AAAA record as well. Do not create an IPv6 record unless the server is reachable over that address.
DNS changes can take time to propagate. Verify the records before troubleshooting the web server.
Step 2: Create the Virtual Host Directories
For a standalone installation using the example paths, create a directory for the virtual host and its main subdirectories:
sudo mkdir -p /usr/local/lsws/ExampleSite/conf
sudo mkdir -p /var/www/example.com/html
sudo mkdir -p /var/www/example.com/logsThese directories serve different purposes:
confstores the virtual host configuration.htmlstores the website files.logscan store website-specific logs if configured.
OpenLiteSpeed’s documented examples place virtual host directories beneath its server root. The website’s document root can be located elsewhere, provided the configuration and permissions are correct.
Step 3: Create a Test Web Page
Create a simple HTML file to verify that the virtual host works:
sudo nano /var/www/example.com/html/index.htmlAdd the following content:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>OpenLiteSpeed Virtual Host</title>
</head>
<body>
<h1>Virtual Host Is Working</h1>
<p>This website is served by OpenLiteSpeed.</p>
</body>
</html>Save the file and exit the editor.
Before making the website public, ensure the web server can read the file and its parent directories. Avoid applying broad permissions such as chmod -R 777 to fix access problems.
Step 4: Add the Virtual Host in WebAdmin
Open the OpenLiteSpeed WebAdmin Console. The default administrative port is commonly 7080, provided it has not been changed.
Navigate to Virtual Hosts and select the option to add a virtual host.
Use settings similar to these:
| Setting | Example value |
|---|---|
| Virtual Host Name | ExampleSite |
| Virtual Host Root | /usr/local/lsws/ExampleSite/ |
| Config File | $SERVER_ROOT/conf/vhosts/ExampleSite/vhconf.conf |
| Enable Scripts/ExtApps | Yes, if required |
| Restrained | According to your intended security model |
The exact available options can vary by OpenLiteSpeed version. Use the paths that match your installation and confirm the settings before saving.
If the configuration file does not exist, WebAdmin may offer to create it. Accept only after checking the intended path.
Step 5: Configure the Document Root
Open the newly created virtual host and locate its general settings.
Set the document root to:
/var/www/example.com/html/Configure the index files to include the files your website actually uses, for example:
index.html, index.phpIf the website uses PHP, its PHP handler and external application settings must also be configured correctly. Creating a virtual host does not automatically guarantee that PHP will execute.
For a static HTML website, the test page created earlier is enough to begin testing.
Step 6: Enable Rewrite Rules if Needed
If the website depends on URL rewriting, enable the virtual host’s rewrite feature.
For example, a WordPress installation may need rewrite rules to route requests to its front controller. The appropriate rules depend on the application and its configuration.
OpenLiteSpeed supports Apache-style rewrite rules, including rules in .htaccess, when automatic loading is enabled. However, it does not support every Apache configuration directive.
Do not copy unrelated Apache directives into an OpenLiteSpeed configuration and assume they will work.
Step 7: Create or Select an HTTP Listener
Navigate to Listeners in WebAdmin.
If an HTTP listener already exists, you may be able to reuse it. Otherwise, create one with settings such as:
| Setting | Example value |
|---|---|
| Listener Name | HTTP |
| IP Address | ANY IPv4 |
| Port | 80 |
| Secure | No |
Under the listener’s Virtual Host Mappings section, add a mapping for the new virtual host.
Set:
- Virtual Host:
ExampleSite - Domains:
example.com, www.example.com
This tells OpenLiteSpeed to route requests for those hostnames to the specified virtual host.
Do not create a duplicate listener if a suitable listener already handles port 80. Multiple virtual hosts can share a listener by using different domain mappings.
Step 8: Configure HTTPS and the SSL Certificate
To serve the website over HTTPS, use a secure listener, normally on port 443.
If an HTTPS listener already exists, map the new virtual host to it. If the listener needs to be created, configure its address, port, and secure settings.
Next, configure the certificate and private key. OpenLiteSpeed supports SSL settings at both listener and virtual host levels. Virtual host-level settings can override listener-level certificate settings when configured correctly.
Use a valid certificate for the domain names being served. If you use Let’s Encrypt, make sure the certificate files exist and that OpenLiteSpeed can read them.
Consult the official OpenLiteSpeed SSL configuration guide for the current WebAdmin settings.
Step 9: Apply the Configuration and Test
Save the configuration changes. Depending on the settings changed and the version in use, a graceful restart or restart may be required.
Before testing, check the DNS records and verify that ports 80 and 443 are reachable through the server’s firewall.
You can test the HTTP response using:
curl -I http://example.comTest HTTPS separately:
curl -I https://example.comTo check which IP address the domain resolves to, use:
dig +short example.comIf the page does not load, inspect the OpenLiteSpeed error log and virtual host logs, where configured. A DNS problem, incorrect domain mapping, invalid document root, permission issue, or certificate error can each produce a different failure.
How to Host Multiple Domains with OpenLiteSpeed
You do not normally need a separate OpenLiteSpeed installation for each domain. Multiple virtual hosts can share one running server and use the same HTTP and HTTPS listeners.
For example, suppose you want to host three independent websites:
| Website | Virtual host | Domain mapping | Document root |
|---|---|---|---|
| Business website | BusinessSite | business.example | /var/www/business/html |
| Online store | StoreSite | store.example | /var/www/store/html |
| Blog | BlogSite | blog.example | /var/www/blog/html |
For each site, create the virtual host, set its document root, and map its domain to the relevant listeners. Point each domain’s DNS records to the server’s IP address.
If all three websites use HTTPS, make sure each domain is covered by a valid certificate. Depending on your certificate and configuration, the virtual hosts can use separate certificates or an appropriate certificate that covers multiple names.
The key is to keep each site’s document root, configuration, and access permissions separate. Sharing a server does not mean that every website should have unrestricted access to the files of every other website.
OpenLiteSpeed Virtual Host vs. CyberPanel Website

OpenLiteSpeed virtual hosts can be configured directly through WebAdmin. CyberPanel is a free and open-source web hosting control panel that automates much of the website setup process on supported installations.
| Feature | Direct OpenLiteSpeed configuration | CyberPanel |
|---|---|---|
| Create virtual hosts | Configure them in WebAdmin | Create websites through the panel |
| Domain mapping | Configure listener mappings | The panel generates the relevant configuration |
| Document root | Set it in virtual host settings | Set up as part of website creation |
| SSL management | Configure certificates in OpenLiteSpeed | Provides supported website SSL management features |
| PHP settings | Configure the appropriate handler and settings | Manage supported PHP versions and website settings through the panel |
| Best suited for | Administrators who want direct server configuration | Hosting administrators managing websites through a panel |
If you are running a CyberPanel-managed server, the usual workflow is to create a website through Websites → Create Website and let the panel generate the website’s virtual host configuration. See the official CyberPanel website creation guide.
Avoid editing generated configuration files manually unless you understand how the panel maintains them. A panel update or configuration regeneration may overwrite unsupported changes.
Common OpenLiteSpeed Virtual Host Problems and Fixes
Even when the virtual host exists, the website may fail to load if DNS, listener mappings, document roots, or permissions are incorrect.
The domain displays the wrong website
Likely cause: The domain is mapped to the wrong virtual host, or the listener is using an unintended catch-all mapping.
Fix: Open the listener’s virtual host mappings and confirm that the domain is associated with the correct virtual host. Check for duplicate or conflicting domain mappings.
The website returns a 404 error
Likely cause: The document root is incorrect, the requested file does not exist, or the request reaches a different virtual host.
Fix: Confirm the document root and index files. Verify that the domain resolves to the correct server and that the listener maps it to the expected virtual host.
The website displays a permission error
Likely cause: OpenLiteSpeed cannot read the document root or its files, or the application’s required permissions are incorrect.
Fix: Inspect file ownership and directory permissions. Grant the minimum access needed to the relevant service or website account. Do not use unrestricted permissions as a workaround.
HTTPS fails while HTTP works
Likely cause: The HTTPS listener is missing, the virtual host is not mapped to it, the certificate is invalid, or the private key path is incorrect.
Fix: Verify the listener on port 443, its virtual host mappings, and the certificate configuration. Check the certificate’s domain names and expiry date.
PHP files download or display as text
Likely cause: The PHP external application or script handler is not configured correctly for the virtual host.
Fix: Review the PHP handler configuration and confirm that the virtual host is associated with the correct handler. Do not expose application source code while troubleshooting; restrict access until PHP execution works correctly.
Configuration changes do not take effect
Likely cause: The configuration was not saved, the required restart was not performed, or a control panel regenerated the configuration.
Fix: Verify the active configuration in WebAdmin, review the error log, and apply the appropriate restart or graceful restart. On panel-managed servers, use the panel’s supported workflow whenever possible.
Frequently Asked Questions
Can OpenLiteSpeed host multiple websites on one IP address?
Yes. OpenLiteSpeed supports name-based virtual hosting, allowing multiple domain names to share one IP address. Each domain must be mapped to the appropriate virtual host, and its DNS records must point to the server.
Does every OpenLiteSpeed virtual host need a separate listener?
No. Multiple virtual hosts can share an HTTP listener and an HTTPS listener. OpenLiteSpeed uses domain mappings to determine which virtual host should handle each request.
Can one OpenLiteSpeed virtual host use multiple domains?
Yes. You can map multiple domain names or aliases to one virtual host when they should serve the same website. Configure the relevant hostnames and ensure the site’s application handles them appropriately.
Conclusion
An OpenLiteSpeed virtual host lets you serve a website under a specific domain while sharing a web server instance with other sites. The essential steps are to configure the virtual host, set its document root, map its domain to the correct listeners, and verify DNS and SSL settings.
For direct installations, WebAdmin gives you control over the virtual host and listener configuration. For CyberPanel-managed hosting, creating the website through the panel is usually the safer route because it generates the required settings. In either case, accurate domain mappings, appropriate file permissions, and valid certificates are essential for a reliable multi-domain setup.