OpenLiteSpeed is a lightweight and open-source web server developed by LiteSpeed Technologies. It is designed to deliver high performance and low resource consumption. This tutorial will guide you through the process of installing the OpenLiteSpeed web server on an Ubuntu 22.04 server.

Step 1: Deploying a Cloud Instance on Shape.host

  • Log in to Shape.host Dashboard:
  • Navigate to the Shape.host website and log in to your account.
  • Create a New Instance:
  • Click on the “Create” button located at the top right corner of the dashboard.
  • From the dropdown menu, select “Instances”.
Shape.host Resources dashboard showing the Create menu and instance rebuild controls.
  • Select Instance Location:
  • Choose the desired location for your server. For this tutorial, we’ll select “New York, USA”.
Shape.host Create New Instance form with the available data center locations.
  • Choose a Plan:
  • Select a plan that fits your requirements. For example, you might choose a plan with 2 cores CPU, 2 GB Memory, and 50 GB SSD disk space.
  • Select an Operating System:
  • Scroll down to the “Choose an image” section and select “Ubuntu 22.04”.
Shape.host instance form with a server plan and Ubuntu image selected.
  • Configure Additional Options:
  • (Optional) You can configure additional options like User Data Configuration and IPv6 Networking.
  • Enter a hostname for your instance, e.g., “Tutorial Ubuntu”.
  • Click on the “Create instance” button to deploy the instance.
Shape.host instance form showing hostname, instance count and the Create Instance button.

Step 2: Connecting to Your Instance

  • Retrieve SSH Credentials:
  • Note the IP address of your newly created instance from the Shape.host dashboard.
  • Connect via SSH:
  • Open a terminal on your local machine.
  • Use the following command to connect to your instance:
    sh ssh root@your_instance_ip
  • Replace your_instance_ip with the actual IP address of your instance.

To complete this tutorial, you will need:

  • An Ubuntu 22.04 server with root access.

Step 3: Installing Required Dependencies

First, update your package index and install any required dependencies:

apt update
apt upgrade -y
apt install curl gnupg2 ca-certificates lsb-release -y
Terminal showing APT package management commands and output.

Step 4: Installing the OpenLiteSpeed Repository

Next, you need to add the OpenLiteSpeed repository to your system. Import the repository’s GPG key and add the repository to your sources list using the following commands:

wget -O - https://repo.litespeed.sh | sudo bash
Terminal showing wget commands or output during Installing the OpenLiteSpeed Repository.

Step 5: Installing OpenLiteSpeed

Once the repository is enabled, you can install OpenLiteSpeed with the following command:

apt update
apt install openlitespeed -y
Terminal showing APT package management commands and output.

Step 6: Starting OpenLiteSpeed

After installing OpenLiteSpeed, start the server and enable it to start at boot:

systemctl start lshttpd
systemctl enable lshttpd
Terminal showing systemd service management commands or output.

You can check the status of the server with:

systemctl status lshttpd
Terminal showing systemd service management commands or output.
Terminal showing systemd service management commands or output.

Step 7: Configuring Firewall

If you have a firewall running, you need to allow traffic on ports 80 (HTTP) and 443 (HTTPS). OpenLiteSpeed also uses port 7080 for the web administration interface and port 8088 for default web access.

Allow these ports through the firewall:

ufw allow 80
ufw allow 443
ufw allow 7080
ufw allow 8088/tcp
Terminal showing firewall configuration commands and rules.

Allow SSH connections to ensure you do not get locked out:

ufw allow ssh
Terminal showing firewall configuration commands and rules.

Enable the firewall:

ufw enable
Terminal showing firewall configuration commands and rules.

You can check the status of the firewall with:

ufw status
Terminal showing firewall configuration commands and rules.
Terminal showing firewall configuration commands and rules.

Step 8: Accessing the OpenLiteSpeed Web Admin Interface

OpenLiteSpeed includes a web-based administration interface. To access it, open your web browser and navigate to your server’s IP address followed by port 7080:

http://your_server_ip:7080
OpenLiteSpeed web console sign-in form.

You will be prompted to enter a username and password. The default username is admin. You need to set a password for the admin user. Use the following command to do so:

/usr/local/lsws/admin/misc/admpass.sh
Terminal showing sh commands or output during Accessing the OpenLiteSpeed Web Admin Interface.

You will be prompted to enter and confirm a new password.

Step 9: Installing PHP

OpenLiteSpeed uses its own PHP package, known as lsphp. To install it, run the following command. Note that you may need to adjust the package names based on what is available in the repository:

apt install lsphp74 lsphp74-common lsphp74-mysql lsphp74-curl lsphp74-imagick lsphp74-memcached lsphp74-opcache lsphp74-redis -y
Terminal showing APT package management commands and output.

Step 10: Creating the Symbolic Link for lsphp

If a file already exists at /usr/local/lsws/fcgi-bin/lsphp5, remove it first and then create a new symbolic link.

Remove the existing file:

rm /usr/local/lsws/fcgi-bin/lsphp5

Create a new symbolic link:

ln -s /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
Terminal showing the PHP executable symlink command for OpenLiteSpeed.

Step 11: Testing OpenLiteSpeed

You can test OpenLiteSpeed to ensure it’s working properly by creating a test PHP file. First, create a new directory for your website:

mkdir -p /usr/local/lsws/Example/html
Terminal showing mkdir commands or output during Testing OpenLiteSpeed.

Then create a test PHP file in this directory:

echo "<?php phpinfo(); ?>" > /usr/local/lsws/Example/html/index.php
Terminal showing mkdir commands or output during Testing OpenLiteSpeed.

Now, navigate to your server’s IP address in your web browser:

http://your_server_ip:8088

You should see the PHP information page, indicating that OpenLiteSpeed and PHP are working correctly.

For reliable hosting solutions, consider using Shape.host services. They offer Linux SSD VPS, providing high performance and stability for your OpenLiteSpeed web server.