When it comes to hosting websites or projects, 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.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related OpenLiteSpeed queries on Debian Linux system.
In this context, we shall look into how to install OpenLiteSpeed web server on Focal Fossa ( Ubuntu 20.04).
Features of OpenLiteSpeed web server:
- 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.
Steps to Install OpenLiteSpeed web server on Ubuntu
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
What this command does is to connect 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. Now run the below command:
$ sudo apt install openlitespeed
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. Now run the below command:
$ sudo apt install lsphp74
Next, proceed and create a symbolic link as provided with the command below:
$ ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
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
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
Be 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.
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 default 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.
Under the 'Address Settings' you can see that the default 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.
[Need help in fixing Apache web server issues? We can help you. ]