Saturday, December 28, 2024
Google search engine
HomeGuest BlogsInstall and Configure OpenLiteSpeed on Ubuntu 20.04|18.04

Install and Configure OpenLiteSpeed on Ubuntu 20.04|18.04

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

OpenLiteSpeed is a high-performance, lightweight, open source HTTP server edition of LiteSpeed Web Server Enterprise. Users are free to download, use, distribute, and modify OpenLiteSpeed and its source code in accordance with the precepts of the GPLv3 license. OpenLiteSpeed combines speed, security, scalability, optimization and simplicity in one friendly open-source package. Source: LiteSpeed Webpage

Features of LiteSpeed Web Server

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

  • Event-Driven Architecture: Fewer processes, less overhead, and enormous scalability
  • HTTP/3 & HTTP/2 Support: Serves your site with the latest internet protocols
  • mod_rewrite Compatible: Rewrite engine understands Apache rewrite rule syntax
  • Multiple PHP Support: Supports embedded PHP, LSAPI for 2x faster external apps
  • Friendly Admin Interfaces: Builtin WebAdmin GUI, CyberPanel, or DirectAdmin control panel
  • Built for Speed and Security: Anti-DDoS features, bandwidth throttling, WAF support, and more
  • Intelligent Cache Acceleration: Efficient, highly customizable full-page cache module
  • PageSpeed Optimization: Automatically implement Google’s PageSpeed optimization system
  • CMS Acceleration: WordPress, Drupal, Joomla and more: superior performance
  • ModSecurity Integration: mod_security v3 integration provides Layer-7 protection
  • One-Click Installation: Install OpenLiteSpeed, MariaDB, and WordPress in one click
  • Multi-Thread Module: The fastest web service platform using custom MT module

With such wealth of features, let us get OpenLiteSpeed installed on Ubuntu 20.04|18.04

.tdi_2.td-a-rec{text-align:center}.tdi_2 .td-element-style{z-index:-1}.tdi_2.td-a-rec-img{text-align:left}.tdi_2.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_2.td-a-rec-img{text-align:center}}

Step 1: Add LiteSpeed 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 - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash

Step 2: Install OpenLiteSpeed onUbuntu 20.04|18.04

With the repository added you can install OpenLiteSpeed web server onUbuntu 20.04|18.04 Linux machine using apt package manager.

You need to make sure APT list is updated before installation is done.

Ubuntu 20.04|18.04:

sudo apt update
sudo apt install openlitespeed

Step 3: Install PHP onUbuntu 20.04|18.04

The commands below will install PHP 7.4 with all commonly-used packages for OpenLiteSpeed from LiteSpeed’s Debian Repo. Following the install, the soft link created will direct OpenLiteSpeed to use the installed PHP.

This build of PHP should be enough to support the most commonly used web applications. If you wish to install an older version such as PHP 5.6, replace lsphp74 to lsphp56.

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

To start the server, we shall run /usr/local/lsws/bin/lswsctrl start and to stop it, we shall run /usr/local/lsws/bin/lswsctrl stop

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

Step 4: Setting the Administrative Password

In order to login to the DirectAdmin control panel, we have to generate an Administrative Password. OpenLitespeed ships with a script to gracefully guide us in this part. Simply run the command below and fill in the details when prompted.

$ sudo /usr/local/lsws/admin/misc/admpass.sh

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.       

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

Running the above will ask you to provide a username. Pressing ENTER without choosing a new username defaults to admin as the new administrative username. Later, you will be prompted to create and confirm a new password for the account. Kindly provide the details then proceed to login.

Step 5: Access OpenLiteSpeed Web Admin onUbuntu 20.04|18.04

As it had been touched on in the features, OpenLiteSpeed comes with friendly Admin Interfaces (Builtin WebAdmin GUI, CyberPanel, or DirectAdmin control panel). The default port that the WebAdmin console listens from is 7080. Point your browser to http://your-server-ip:7080 and you should get a login page as shown below. Enter the username and password you just created.

LiteSpeed login page 1

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

LiteSpeed dashboard 2

Step 6: Creating a Test Virtual Host on OpenLiteSpeed

From the interface, it is very easy to create a virtual host. Simply click on the “Virtual Hosts” tab and click on + as illustrated below. You will be presented with a form where you will fill in with details that correspond to your settings.

LiteSpeed virtual host 3

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

LiteSpeed virtual host created 4

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:

LiteSpeed virtual host port 8088

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
<html>
<head>
<?php
echo '<title>Sample PHP Script</title>';
?>
</head>
<body>
        <?php
               echo '<p>This is to confirm that our PHP is working</p>';
        ?> 
                <h1>OpenLiteSpeed</h1>
               <p>OpenLiteSpeed is a high-performance, lightweight, open source HTTP
               server edition of LiteSpeed Web Server Enterprise</p>
</body>
</html>

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

LiteSpeed virtual host test php 6

And our webserver is in good shape!

Step 7: Change default Virtual Host Listening Port

If you are unhappy with the default port 8088 where Virtual Hosts listen for connections by default, you can change the value to the one you are comfortable with. Click on “Listeners” then on “View” as illustrated on the image below.

LiteSpeed virtual host listeners change port 7

That will open the Listeners configuration page. On the page, click on the edit icon to alter with the defaults. The image below illustrates that.

LiteSpeed virtual host listeners change port 8

Once editing has been enabled, you are free to choose the port of your choice. After you are done, save your configurations by clicking on the save icon as illustrated below.

LiteSpeed virtual host listeners change port 9

As you may have guessed, openlitespeed webserver has to be restarted to create the new changes. Click on the grace restart button and you will be good to go.

LiteSpeed virtual host listeners change port restart 10

You can go ahead and test your file against the new port. Remember to allow the port on your firewall if you have one running.

LiteSpeed virtual host listeners change port new port page 11

Concluding Remarks

There is so much that OpenLiteSpeed webserver can do. We have just covered the basics here. You can use it as a reverse proxy, host Joomla, Drupal, setup cache and much more. Kindly check out OpenLiteSpeed Configuration to find out a lot of things that OpenLiteSpeed can offer for your use.

Web Design courses:

As you continue to navigate this difficult period, we wish you health, strength and determination to face it all. We appreciate you stopping by, your continued support and staying till the end. Other guides that will interest you include:

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

RELATED ARTICLES

Most Popular

Recent Comments