How to create and configure VirtualHost to the OpenLiteSpeed server

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

In the previous article, we have seen how to install openlitespeed server on ubuntu. In this tutorial, we will see how to add VirtualHost to the server.

So, Let’s begin

Create a Virtual Host

First, make the virtual host’s directories. I will name my virtual host “unixcop”. In the command line, I go to my LSWS directory and make the following directories:

cd /usr/local/lsws
sudo mkdir unixcop
sudo mkdir unixcop/{conf,html,logs}

I then make conf owned by lsadm:lsadm (the WebAdmin console user) so that only the WebAdmin console will be able to manipulate configurations. (You should not allow other users permission to manipulate your configuration.)

sudo chown lsadm:lsadm unixcop/conf

Then I go to the WebAdmin console > Virtual Hosts > Add to add the virtual hosts to OpenLiteSpeed

You have to enter the virtual host’s name, the virtual host root file, and the virtual host configuration file. You also need to choose whether to enable scripts on this site and whether users can access content outside of this virtual host root from the site (Restrained).

Make & change them like bellow:

Go to the general tab & make the Document Root looks like this

Create and Assign Listeners

Go to the WebAdmin console > Listeners.

You can have one listener to listen on all local IP addresses, or you can create multiple listeners with each listener only listening to a specific IP address. Many users will find it simpler to have one listener that is then mapped to different domains, but having multiple listeners can be useful if, for example, you wish to set aside certain server processors for certain sites

I don’t need anything special, so I just go to the Default listener

Click VirtualHost maping add click Add icon

Add the following details (As per my environment)

This image has an empty alt attribute

Graceful Restart

Once you are done, make a graceful restart

And that’s it ! you are done, check the virtualhost section of the dashboard, yuo will see unixcop

OpenLiteSpeed supports Server Name Indication (SNI), allowing users to set SSL certificates at the virtual host level. This means that virtual hosts (websites) with different SSL certificates can operate on the the same IP address and port number. Different listeners (and IP-based hosting) are not necessary for secure sites to have unique certificates.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Mel
Melhttps://unixcop.com
Unix/Linux Guru and FOSS supporter

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook