How to Create Virtual Hosts in OpenLiteSpeed Web Server

Creating Virtual Hosts in OpenLiteSpeed Web Server

In this article, we are going to see how to create a virtual host in OpenLiteSpeed webserver.

In our last article, we discussed the installation of OpenLiteSpeed on CentOS 7.

To begin, log in to OpenLiteSpeed WeAdmin console by going to below URL.


Create Virtual Hosts in OpenLiteSpeed web server

Go to Virtual Hosts section and click on Add icon.

Add the below configuration:

Variables Value
Virtual Host Name
Virtual Host Root $SERVER_ROOT/
Config File $SERVER_ROOT/conf/vhosts/$VH_NAME/
Follow Symbolic Link Yes
Enable Scripts/ExtApps Yes
Restrained Yes
ExtApp Set UID Mode Server UID

n the configuration, we have used variables for relative paths.

Variables Path Remarks
$SERVER_ROOT /usr/local/lsws/ A location where OpenLiteSpeed is present
$VH_ROOT /usr/local/lsws/$VH_NAME Specifies the root directory of the virtual host where all the files related to the virtual host (like log files, CGI scripts, etc). Note: This is NOT the document root
Config DIR /usr/local/lsws/conf/vhosts/$VH_NAME The configuration filename and directory for this virtual host

When you click on the save button; OpenLiteSpeed will through an error saying config file does not exist.

So, CLICK ON CREATE to let OpenLiteSpeed creates virtual host configuration file for you.

You would get a message like below on the successful creation of virtual host configuration file.

Now, Click Save.

Your configuration will be looks like:

Once the virtual host is created, go to Virtual Hosts –> Choose Virtual Host (you have created) –> General Tab and modify the configurations like shown below.

Variables Value
Document Root $VH_ROOT/html/
Domain Name
Enable GZIP Compression Yes

Variables we have used here are,

Variables Path Remarks
$VH_ROOT/html/ /usr/local/lsws/$VH_NAME/html This the document root.

Go to Virtual Hosts –> Choose Virtual Host (you have created) –> General –> Index Files. Set the index file name.

Variables Value
Use Server Index Files No
Index Files index.html
Auto Index No

Go to Virtual Hosts –> Choose Virtual Host (You have created) –> Log —> Virtual Host Log. Set the log file to store OpenLiteSpeed error logs.

Variables Value
Use Server’s Log Yes
File Name $VH_ROOT/logs/error.log
Log Level ERROR
Rolling Size (bytes) 10M

Go to Virtual Hosts –> Choose Virtual Host (You have created) –> Log –> Access Log. Set the log file to store OpenLiteSpeed access logs.

Variables Value
Log Control Own Log File
File Name $VH_ROOT/logs/access.log
Piped Logger Not Set
Log Format Not Set
Log Headers Not Set
Rolling Size (bytes) 10M
Keep Days 30
Bytes log Not Set
Compress Archive Yes

Go to Virtual Hosts –> Choose Virtual Host  –> Security. Allow everyone to access web pages.

Enter ‘*‘ in Allow list.

Mapping Virtual Host in OpenLiteSpeed

Once you have configured a virtual host, you need to map the virtual host with specific domain so that you can access it via fully qualified domain. To do that, go to Listeners and click on Zoom icon view the Default listener.

Now, add virtual host mapping.

Use the below details.

Variables Value
Virtual Host

Create Document root

Now, create the document root and logs directory for the virtual host by logging into your SSH.

mkdir /usr/local/lsws/

mkdir /usr/local/lsws/{html,logs}

cd /usr/local/lsws/

nano index.html

Add “This page served by OpenLiteSpeed Web Server running on CentOS 7 Operating System”

Now, restart the OpenLiteSpeed service.

Now, your Dashboard will look like the below screenshot with virtual hosts

Verify Virtual Hosts in OpenLiteSpeed

Now access in your web browser to verify your virtual host.

Now, you have configured the virtual host in your OpenLiteSpeed web server, you can modify your index.html as you wish.

For installing and configuring Apache Tomcat 8.5, Click here



You may also like...

5 Responses

  1. Today, I went to the beach with my children. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is totally off topic but I had to tell someone!

  2. Emil Brouk says:

    I couldn’t refrain from commenting. Very well written!

  3. Aw, this was an extremely nice post. Finding the time and actual effort to generate a superb article… but what can I say… I procrastinate a lot and don’t seem to get nearly anything done.

  4. This is a topic which is near to my heart… Thank you! Where are your contact details though?

  5. Myrta Towe says:

    Can I simply just say what a comfort to discover someone who really knows what they’re talking about on the net. You actually understand how to bring a problem to light and make it important. More people have to look at this and understand this side of your story. I can’t believe you aren’t more popular because you most certainly possess the gift.

Leave a Reply

Your email address will not be published.