How to Install and Configure OpenLiteSpeed on Ubuntu 22.04

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:

Then install any pending upgrades:

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

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

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

sudo apt install openlitespeed lsphp81

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:

Step 3 – Connecting to the 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

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

Open your browser and navigate to:

http://server_domain_or_IP:8088

Step 4 – Changing the Port for the Default Page

To change the port from 8088 to the conventional HTTP port 80, open the OpenLiteSpeed admin interface:

https://server_domain_or_IP:7080

Log in with your administrative credentials. Navigate to “Listeners”, select “Default”, and change the port from 8088 to 80. Save the changes and restart the server by clicking “Graceful Restart”.

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.

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

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in: