In the hosting space, the predominant web servers are Apache and Nginx. These are two of the most widely used web servers in enterprise environments and also among ordinary Linux users for testing purposes. Another less known , yet equally powerful and feature-rich web server is the OpenLiteSpeed webserver. OpenLiteSpeed webserver is the opensource version of the LiteSpeed Enterprise webserver which is considered an alternative to Apache.
OpenLiteSpeed provides some of the following features:
- An event-driven architecture that yields less overhead and promises superb scalability.
- Bandwidth throttling and Anti-DDoS
- Compatibility with Apache Rewrite Rules
- Support for HTTP v/3 and HTTP v/2
- Built-in web administration interface
- PageSpeed optimization
- Support for the latest versions of PHP
Let us now shift gears and install OpenLiteSpeed web server on Focal Fossa ( Ubuntu 20.04).
Step 1: Enable OpenLiteSpeed repository
To start off, log in as root user and add the OpenLiteSpeed repository to your instance as demonstrated in the command below.
$ wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash
The command connects to the online OpenLiteSpeed repository , downloads the repo and registers the LiteSpeed GPG key. Thereafter, it updates the package index to sync with the new OpenLiteSpeed repository.
Once completed, install OpenLiteSpeed using the APT package manager as shown.
$ sudo apt install openlitespeed
Step 2: Enable PHP support for OpenLiteSpeed
By default, OpenLiteSpeed doesn’t provide the stable version of PHP. with that in mind, we need to install a stable PHP version to provide support for webpages in PHP. Here. we are installing PHP 7.4 alongside other packages and dependencies.
$ sudo apt install lsphp74
Next, proceed and create a symbolic link as provided.
$ ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
Step 3: Start OpenLiteSpeed webserver
Finally start OpenLiteSpeed by issuing the command below.
$ sudo /usr/local/lsws/bin/lswsctrl start
The OpenLiteSpeed, by default, listens on port 8088 and also provides a WebGUI admin interface at port 7080. Both of these ports should be open. To confirm that OpenLiteSpeed is listening to both of these ports, run the netstat command as shown.
$ sudo netstat -pnltu | grep -i openlitespeed
Step 4: Configure Admin password for the Control panel
To access the Adminstrative dashboard, you need to set a username and password. To accomplish this , run the command.
$ sudo /usr/local/lsws/admin/misc/admpass.sh
B sure to specify the username and password for the Admin user. Once done, visit the URL shown.
Provide the username and password and click on ‘Login’ to access the OpenLiteSpeed dashboard shown.
Step 5: Configure OpenLiteSpeed to listen to port 80 instead of port 8088
As earlier stated, OpenLiteSpeed web server listens on port 8088 by default. Now, this is not desirable as users will always be required to specify the port number every time they access a web page.
As such, it’s prudent to change the port to the defaul port 80 that is the conventional port used by a majority of web servers. On the left sidebar, click on ‘Listeners’ option and then click on the find button as shown by the arrow.
Under the ‘Address Settings’ you can see that the defaul port is indicated as 8088. HIt the ‘Edit’ button.
And set the port to port 80. Finally, click on the ‘Save’ icon to effect the changes.
Then restart OpenLiteSpeed web server.
Next time you browse your server’s address, the default webpage will be displayed even without specifying the port number.
And this brings the curtain to a close on this topic. Thanks for your patronage and for joining us in this guide where we have demonstrated how to install and configure OpenLiteSpeed webserver.