How To Install the OpenLiteSpeed Web Server on Ubuntu 22.04

Estimated reading: 6 minutes 730 views

Introduction

OpenLiteSpeed is an optimized, open-source web server that can be used to manage and serve sites. OpenLiteSpeed has useful features that make it a strong choice for many installations, including Apache-compatible rewrite rules, a built-in web-based administration interface, and customized PHP processing optimized for the server.

In this tutorial, you will install and configure OpenLiteSpeed on an Ubuntu 22.04 server.

Prerequisites

To complete this tutorial, you will need an Ubuntu 22.04 server with a sudo-enabled, non-root user and the ufw firewall enabled, which you can set up by following the Initial Server Setup with Ubuntu 22.04.

Step 1 – Installing OpenLiteSpeed

Before using OpenLiteSpeed, you will need to install it. OpenLiteSpeed provides a software repository that you can use to download and install the server with Ubuntu’s standard apt command.

Begin by updating the package manager cache:

sudo apt update

Then install any pending upgrades:

sudo apt upgrade

If prompted, enter your password, then confirm the installation with Y.

To enable this repository for your Ubuntu system, download and add the developer’s software signing key:

sudo wget -O - https://repo.litespeed.sh | sudo bash

wget fetches a shell script located on OpenLitespeed’s server that will automatically perform the necessary steps to add the Litespeed repository to Ubuntu’s apt package manager. The content of the shell script is passed to a new bash shell via the | pipe.

The output of this command will be:

Output

Update the list of repositories to ensure that the newly added repository is scanned by the apt package manager:

sudo apt update

To install the OpenLitespeed server and the corresponding LiteSpeed PHP interpreter, run the command:

sudo apt install openlitespeed lsphp81

If prompted, enter your password, then confirm the installation with Y.

This command installs the Openlitespeed server package and LSPHP 8.1. LiteSpeed PHP (LSPHP) is a PHP interpreter integrated with the LiteSpeed Server Application Programming Interface (LSAPI).

Now that the OpenLiteSpeed server is installed, you will secure it by updating the default administrator account.

Step 2 – Setting the Administrative Password

Before testing the server, you will set a new administrative password for OpenLiteSpeed. You can do this by running a script provided by OpenLiteSpeed:

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

You will be asked to provide a username for the administrative user. If you press ENTER without choosing a new username, the default username admin will be used. You can use whatever administrative username you prefer. Then you will be prompted to create and confirm a new password for the account. Put in the administrative password you prefer, then press ENTER again. The script will confirm a successful update:

Output


You have now secured the admin account. Next, you will test the server to ensure it’s running properly.

Step 3 – Connecting to the Server

In this step, you will connect to your server.

OpenLiteSpeed should have started automatically after it was installed. You can verify if it started with the systemctl status command:

sudo systemctl status lsws

This command will print the following output:

Output


The active (running) message indicates that OpenLiteSpeed is running.

If your server is not running, you can start the server using systemctl:

sudo systemctl start lsws

The server should now be running. Press CTRL+C to exit the service output.
Before visiting it in your browser, you will need to open some ports on your firewall, which you can achieve with the ufw command:

sudo ufw allow 8088,7080,443,80/tcp

The first port, 8088, is the default port for OpenLiteSpeed’s example site. After allowing it with ufw, it should now be accessible to the public. In your web browser, navigate to your server’s IP address or domain name, followed by :8088 to specify the port:

http://server_domain_or_IP:8088

Your browser will load the default OpenLiteSpeed web page, which will match the following image:

Screencapture of the default OpenLiteSpeed demo page

The links at the bottom of the page demonstrate various features of the server. If you click through them, you may notice that these features are already installed and properly configured, including an example CGI script that is available, a customized PHP instance that is up and running, and custom error pages and authentication gates that are configured.

When you are satisfied with the default site, you can move on to the administrative interface. In your web browser, navigate to your server’s domain name or IP address using HTTPS and followed by :7080 to specify the port:

https://server_domain_or_IP:7080

You will likely see a page warning you that the SSL certificate from the server cannot be validated. Because this is a self-signed certificate, this message is expected. Click through the available options to proceed to the site. In Chrome, you must click Advanced and then Proceed to….

You will be prompted to enter the administrative username and password that you selected with the admpass.sh script in the previous step:

screencapture of the OpenLiteSpeed admin login page

Once authenticated, you will be presented with the OpenLiteSpeed administration interface:

screenshot of the OpenLiteSpeed admin dashboard

The majority of your configuration for the web server will take place via this dashboard.

In this step, you connected to the server via newly opened ports. Next, you will update the port used by the default page.

Step 4 – Changing the Port for the Default Page

To demonstrate how to configure options through the web interface, you will change the port that the default site uses from 8088 to the conventional HTTP port (80).

Start by pressing Listeners in the list of options on side navigation bar. A list of all available listeners will load.

From this list, click the magnifying glass, which is the View button, for the Default listener:

screencapture of OpenLiteSpeed's listeners summary page

This action will load a page with more details about the Default listener. Click the edit button (the pen and paper symbol) in the top-right corner of the Address Settings table to modify its values:

screencapture of OpenLiteSpeed's listener detail page

This button will open a new screen. Change port 8088 to port 80, then click the Save button (the floppy disk symbol):

screencapture of OpenLiteSpeed's listener update interface

After saving the modification, you will need to restart the server. Click the arrow icon for the Graceful Restart action that will restart OpenLiteSpeed:

screencapture displaying the arrow for the graceful restart button

If you are prompted to restart LiteSpeed, press the Go button.

The default web page should now be accessible in your browser on port 80 instead of port 8088. Visiting your server’s domain name or IP address without providing a port number will now display the site.

You can now add any HTMLCSSJS or other files that you wish to feature on your website to the directory located at /usr/local/lsws/Example/html.

Conclusion

At this point, you have OpenLiteSpeed and PHP installed and running on an Ubuntu 22.04 server. OpenLiteSpeed offers great performance, a web-based configuration interface, and pre-configured options for script handling.

 

Share this Doc

How To Install the OpenLiteSpeed Web Server on Ubuntu 22.04

Or copy link

CONTENTS