Install And Configure OpenLiteSpeed on Ubuntu 20.04 | 18.04

Hitori Tech

OpenLiteSpeed is an open-source version of LiteSpeed Web Server Enterprise that is fast, lightweight, and free to use. OpenLiteSpeed and its source code are available under the GPLv3 licence, which allows users to freely download, use, distribute, and modify the software. OpenLiteSpeed is a fast, secure, scalable, optimised, and simple web server solution. Credit: LiteSpeed Website

Features of Lightspeed Web Server :

Some of the top reasons why you should consider LiteSpeed include its features as follows:

  • There are fewer moving parts, less overhead, and tremendous scalability with an Event-Driven Architecture.
  • Your site will be served using the most recent versions of HTTP (3.0) and HTTP/2
  • (1.1) thanks to mod_rewrite. Compatible: The rewriting engine is compatible with Apache rewrite rules.
  • Allows for two times as quick external applications thanks to support for both embedded PHP and LSAPI.
  • User-Friendly Admin Interfaces: In-Built WebAdmin graphical user interface, CyberPanel, or DirectAdmin
  • Designed with Performance and Security in Mind: Anti-DDoS Protection, Bandwidth Control, Web Application Firewall, and More
  • Effective, highly modifiable full-page cache module with Intelligent Cache Acceleration
  • Google’s PageSpeed Optimisation System Automatically Deployed
  • Content Management System Acceleration (CMS): WordPress, Drupal, Joomla, and More excellent results
  • Integration with mod_security v3 enables Layer-7 security.
  • OpenLiteSpeed, MariaDB, and WordPress may all be installed with a single click.
  • Fastest web service platform with specialised multi-threaded module

Let’s install OpenLiteSpeed on Ubuntu 20.04|18.04 to take use of its many capabilities.

Step 1 : Add Repository to Ubuntu 20.04 | 18.04

The provided APT repository contains all the latest packaged for LiteSpeed. Add the repository to your Ubuntu system by running the following commands in your terminal.

Ubuntu 20.04|18.04:

wget -O - | sudo bash

Step 2 : Install OpenLiteSpeed On Ubuntu 20.04 | 18.04

Using the apt package manager, the OpenLiteSpeed web server can be installed on an Ubuntu 20.04|18.04 Linux workstation once the repository has been added.

Prior to finishing the installation, check to see if the APT list needs updating.

Ubuntu 20.04 | 18.04

sudo apt update
sudo apt install openlitespeed

Step 3 : Install php On Ubuntu 20.04 | 18.04

Using the LiteSpeed Debian Repo, PHP 7.4 and all the most popular OpenLiteSpeed packages may be installed with the following commands. After the installation is complete, OpenLiteSpeed will use the installed PHP by following the soft link.

This version of PHP should be sufficient to run the majority of today’s popular web software. Change lsphp74 to lsphp56 if you want to roll back to an earlier version of PHP, such as PHP 5.6.

sudo apt-get install lsphp74
sudo ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5

The server will be started and stopped using the commands /usr/local/lsws/bin/lswsctrl start and /usr/local/lsws/bin/lswsctrl stop.

 sudo /usr/local/lsws/bin/lswsctrl start
[OK] Send SIGUSR1 to 94667

Step 4 : Setting Up the Administrative Password

An Administrative Password must be created before accessing the DirectAdmin interface. A script is included with OpenLitespeed to help us through this step. Just type in the command and then answer the questions.

$ sudo /usr/local/lsws/admin/misc/

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: Geeksadmin

Please specify the administrator's password.
This is the password required to login the administration Web interface.       

Retype password: <RETYPE-PASSWORD>
Administrator's username/password is updated successfully!

When you run the preceding, you’ll be prompted to enter a username. If you press ENTER without selecting a new username, admin will be set as the new administrator. You’ll be asked to change and confirm your account password at a later time. Please enter your information and continue with the login process.

Step 5 : Access OpenLiteSpeed Web Admin onUbuntu 20.04 | 18.04

OpenLiteSpeed has user-friendly Admin Interfaces (Builtin WebAdmin GUI, CyberPanel, or DirectAdmin control panel), as mentioned in the features. The WebAdmin console has a default listening port of 7080. You can access the login screen shown below by pointing your browser to http://your-server-ip:7080. Type in the new login credentials you just made.

And you should be ushered into a dashboard similar to the screenshot below

Step 6 : Creating a Test Virtual Host on OpenLiteSpeed

Making a virtual host from the user interface is simple. Simply navigate to the “Virtual Hosts” menu and add a new one as shown below. You’ll be shown a form to fill out with information specific to your preferences.

Fill in the form with the details corresponding to your desired configuration.

Let us create a sample php file in the Default Virtual Host directory to check of our webserver is working well. By default, the OpenLiteSpeed virtual host accepts connections on port 8088. If you point your browser to that port, you should see a page like below:

So to serve our test page, we will point our browser to http://your-server-ip:8088/file-name

Create a Sample php test file :

$ sudo vim /usr/local/lsws/Example/html/test.php
echo '<title>Sample PHP Script</title>';
               echo '<p>This is to confirm that our PHP is working</p>';
               <p>OpenLiteSpeed is a high-performance, lightweight, open source HTTP
               server edition of LiteSpeed Web Server Enterprise</p>

Point our browser to http://your-server-ip:8088/test.php

And Our Webservers is in Good shape!

Step 7: Change default Virtual Host Listening Port

Virtual Hosts typically listen for connections on port 8088, but you can alter this to an other port number if you choose. To see the list of listeners, follow the steps shown in the figure below and click the “Listeners” tab, followed by the “View” button.

The Listeners settings page will load. To make changes to the page’s default settings, select the edit button. You may see that depicted in the figure below.

Once changes may be made, you can select the port you like. When you’re through making changes, just click the “Save” button to keep them.

You guessed it: restarting openlitespeed webserver is required for the changes to take effect. To continue, just use the “grace restart” button.

You can now try out your file using the updated port. Don’t forget to make sure the port is open in your firewall.

Concluding Remarks :

OpenLiteSpeed webserver is incredibly versatile. The foundations have been laid here. You can use it as a reverse proxy, install caching, and host content management systems like Joomla and Drupal. Please see OpenLiteSpeed Configuration for details on the many features available in OpenLiteSpeed.

Leave a Comment