Guides 11792 Published by

The guide shows how to use the OpenLiteSpeed WebAdmin console to create a new VirtualHost, starting by logging in and clicking “Create” under Virtual Hosts, then naming it (e.g., myblog), assigning its domain name such as www.myblog.com, and pointing the Document Root to your site folder. After that you’ll see step‑by‑step instructions for adjusting the context settings—choosing index files like index.php,index.html, adding rewrite rules so pretty URLs work, and optionally setting up an alias if a subpath needs its own directory. SSL is handled next: check the Enable box, paste your full‑chain certificate and private key, or generate a quick self‑signed cert when you’re just testing to avoid browser warnings. The final part reminds you to perform a graceful restart so the changes load, then test the site in a browser while reviewing the access logs for any 404s or server errors.



How to Create and Configure a VirtualHost in OpenLiteSpeed

You’ll learn the exact steps to spin up a new VirtualHost, set its document root, enable SSL, and get it running on OpenLiteSpeed without any guessing.

1. Log into the OpenLiteSpeed WebAdmin Console

Open your browser, go to https://your‑server:7080 (or whatever port you chose), and log in. If this is a fresh install, use admin/admin. This console is where you’ll create the VirtualHost.

Doing everything through the GUI keeps you from messing up /usr/local/lsws/conf/httpd_config.conf by hand—unless you’re feeling adventurous.

2. Add a New VirtualHost

Click Virtual Hosts => Create.

Give it a short name like myblog.

  • Domain Name(s): type the domain that will point to this host (e.g., www.myblog.com).
  • Document Root: choose where your site files live, e.g., /home/user/sites/myblog.

Click Save. The console writes a new block into the config.

OpenLiteSpeed uses that block to decide which files to serve for each incoming request.

3. Configure Index Files and Rewrite Rules

Still in the VirtualHost editor, click Context => Default.

Set Index File(s) to index.php,index.html.

If you’re running WordPress or another CMS that relies on pretty URLs, enable Rewrite and paste:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L]

Without the rewrite rule, pretty permalinks will break with 404 errors.

4. Enable SSL (Optional but Recommended)

Open SSL tab in your VirtualHost.

Check Enable.

If you already have a certificate:

  • Certificate: paste the full chain file.
  • Private Key: paste the private key.

If not, click Generate Self‑Signed to create a quick test cert—remember it will trigger browser warnings.

HTTPS is non‑negotiable for modern sites; OpenLiteSpeed handles it cleanly once you point it at your certs.

5. Add an Alias (Optional)

If you want /blog on the same domain to point elsewhere, go to Alias tab and add:

/blog /home/user/sites/myblog/blog

Aliases let you map URLs to directories that aren’t under the main document root without touching VirtualHost logic.

6. Restart OpenLiteSpeed

From the console top bar, click Actions => Graceful Restart (or use SSH: sudo /usr/local/lsws/bin/lswsctrl restart).

This reloads the config without dropping connections.

Without a restart, your changes stay in limbo and won’t take effect.

7. Test Your Site

Open a browser to http://www.myblog.com. If you set up SSL, use https://.

  • Check that the correct files appear.
  • Verify pretty URLs work (try /about if you have one).
  • Look at the console logs under Logs => Access for any 404s or 500s.

The logs tell you exactly what OpenLiteSpeed thinks is happening; they’re your quickest debugging tool.

Real‑world tip

When I set up a second blog on the same server, I forgot to update the Domain Name(s) field. The site kept hitting the default host and returning a 404. A quick edit in the VirtualHost config fixed it—no need to touch the global httpd_config.conf again.

That’s all you need: create the VirtualHost, set the root, tweak index and rewrite rules, add SSL if required, restart, and test. You’ll have your site up in minutes without wrestling with Apache syntax.