Adding Virtual Host

Initially, we will have to create virtual host's directory. Naming it as myFirstWebsite as an example here.

In the command line, run the following commands.

mkdir /var/www
cd /var/www
mkdir myfirstwebsite/{conf,html,logs}
chown lsadm:lsadm myfirstwebsite/conf

Next, goto Virtual Hosts section and click on the "+" icon. openlitespeed

Virtual Host Root * == /var/www/myfirstwebsite/

Config File * == $SERVER_ROOT/conf/vhosts/myfirstwebsite/vhconf.conf

openlitespeed

Hit save

Next, click on "CLICK TO CREATE"

openlitespeed

Set both these values to YES,

openlitespeed

Save the changes and go back to Virtual Host's configurations and specify the document's root,

openlitespeed

openlitespeed

Create and Assign 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 or conduct special functions on separate ports.

We shall just set default listener in our case (that listens to all IPs on port 80)

openlitespeed

Then add new mapping:

openlitespeed

Input the domain for the virtual host ("your.domain" will match both "www.your.domain" and "your.domain")

openlitespeed

Graceful Restart

Once these configuration has been modified, perform a graceful restart to apply the changes.

openlitespeed

openlitespeed

This concludes adding Virtual Host.