SnapShooter Learning Center

How To Install the OpenLiteSpeed Web Server on Ubuntu 20.04

How To Install the OpenLiteSpeed Web Server on Ubuntu 20.04

Simon Bennett]
Simon Bennett
Last Updated: Oct 20, 2021
Table of Contents

# Introduction

OpenLiteSpeed is a free, open-source and lightweight web server that offers powerful features and performance to your sites. It supports all the apache rewrite rules and caching features that help you to implement the fastest caching on your server. It is the open-source version of the LiteSpeed Enterprise web server which combines speed, security, scalability, optimization and simplicity in a single package.

Features

  • Support IPv4 and IPv6
  • Support Accept-filters and TCP_DEFER_ACCEPT
  • Keep-alive connections
  • Custom error pages and Autoindexing
  • Unlimited concurrent connections

In this post, we will show you how to install the OpenLiteSpeed web server with PHP support on Ubuntu 20.04.


# Requirements

  • A server running Linux operating system.
  • A root password is set up on your server.

# Update Your System

Before starting, it is recommended to update your system's package cache to the latest version. You can do it using the following command:

apt-get update -y

Once your system's package cache is updated, install other required dependencies using the following command:

apt-get install curl gnupg2 unzip git nano wget -y

Once all the packages are installed, you can proceed to the next step.


# Install OpenLiteSpeed on Ubuntu 20.04

By default, the OpenLiteSpeed package is not included in the Ubuntu 20.04 default repository. So you will need to add the OpenLiteSpeed repository to your system. You can add it by running the following script:

wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash

Next, install the OpenLiteSpeed web server package using the following command:

apt-get install openlitespeed -y

Once the installation has been completed, start the OpenLiteSpeed service using the following command:

/usr/local/lsws/bin/lswsctrl start

By default, OpenLiteSpeed listens on ports 7080 and 8088. You can check them with the following command:

ss -antpl | grep litespeed

You will get the following output:

LISTEN    0         4096               0.0.0.0:7080             0.0.0.0:*        users:(("litespeed",pid=7635,fd=9),("litespeed",pid=7633,fd=9))                
LISTEN    0         4096               0.0.0.0:8088             0.0.0.0:*        users:(("litespeed",pid=7635,fd=8),("litespeed",pid=7633,fd=8))               

Now, open your web browser and access the OpenLiteSpeed default page using the URL http://your-server-ip:8088. You should see the following page:

OpenLiteSpeed Default Page


# Set Up OpenLiteSpeed Administrative User

By default, the OpenLiteSpeed admin username and password is not set. You can set it using the following command:

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

You will be asked to an admin user and password as shown below:

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

User name [admin]: admin

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

Password: 
Retype password: 
Administrator's username/password is updated successfully!

# Access OpenLiteSpeed Admin Interface

Now, open your web browser and access the OpenLiteSpeed admin interface using the URL https://your-server-ip:7080. You should see the OpenLiteSpeed login page:

OpenLiteSpeed Login Page

Provide your admin username, password and click on the Login button. You should see the OpenLiteSpeed dashboard:

OpenLiteSpeed Dashboard


# Change OpenLiteSpeed HTTP Port

By default, OpenLiteSpeed serves web pages on port 8088. It is recommended to change it to 80.

Click on the "Listeners" in the left pane, you should see the following page:

OpenLiteSpeed Listener Page

Click on the View button. You should see the following page:

OpenLiteSpeed Display Listener

Click on the Edit icon to edit the default settings as shown below:

OpenLiteSpeed Edit Listener

Change the default port from 8088 to 80 and click on the Save icon. Then, click on the *restart icon to restart OpenLiteSpeed to apply the changes. You can now access the OpenLiteSpeed default website using the URL http://your-server-ip.


# Install PHP 7.4 on OpenLiteSpeed

By default, OpenLiteSpeed comes with PHP version 7.3. In this section, we will show you how to install PHP 7.4 on OpenLiteSpeed.

First, install PHP 7.4 with the following command:

apt-get install lsphp74 -y 

Next, create a symblic link of PHP 7.4 using the following command:

ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5

Next, go to the OpenLiteSpeed admin interface => Server Configuration and Edit the LiteSpeed SAPI App as shown below:

OpenLiteSpeed Edit SAPI App

Change the Name from lsphp73 to lsphp74 and Command from lsphp73/bin/lsphp to lsphp74/bin/lsphp then click on the Save button to apply the changes.

Next, go to the Script Handler tab and edit the lsphp handler. Switch the Handle name to lsphp74 from the drop-down menu.

OpenLiteSpeed Edit Script Handler

Next, click on the Save icon and click on the restart icon to apply the changes.

Now, open your web browser and verify the PHP version using the URL http://your-server-ip/phpinfo.php. You should see the PHP 7.4 in the following page:

OpenLiteSpeed PHP 7.4 Test Page


# Conclusion

In the above guide, we explained how to install the OpenLiteSpeed web server on Ubuntu 20.04. We also explained to install PHP version 7.4 on OpenLiteSpeed. You can now start to host your website on high-performance web server.


Did you find this article helpful?