How to Install & Configure LiteSpeed on Ubuntu 22

First lets see why LiteSpeed is way better then Apache:

  • Performance: LSWS is miles ahead of Apache in terms of performance and the implementation of HTTP/3. It also continues to improve HTTP/2 and optimize WordPress performance.
  • Efficiency: LSWS is designed to be a drop-in replacement for Apache, but it is not based on Apache codeInstead, it shares similarities with Nginx under the hood.
  • WebGUI: LSWS comes with a WebGUI-based administration panel, making management easier.
  • Scalability: LSWS is highly scalable and can handle a large number of concurrent connections efficiently.
  • LSCache: LSWS integrates seamlessly with LSCache, a powerful caching solution that significantly improves website speed.

Bellow you will find the step-by-step process of installing and configuring LiteSpeed Web Server (LSWS) on Debian 12.

Prerequisites

Before we begin, ensure you have the following:

  1. A server running Debian 12.
  2. A non-root user with sudo privileges.
  3. A fully qualified domain name (FQDN) pointing to your server (e.g., example.com).

Step 1: Configure Firewall

  1. Debian comes with ufw (Uncomplicated Firewall) by default. Check if it’s running:
    sudo ufw status
  2. Allow SSH, HTTP, HTTPS, and the port related to OpenLiteSpeed:
    sudo ufw allow OpenSSH
    sudo ufw allow http
    sudo ufw allow https
    sudo ufw allow 7080/tcp
    sudo ufw enable

Step 2: Install OpenLiteSpeed

  1. Install OpenLiteSpeed from the LiteSpeed repositories:
    sudo apt update
    sudo apt install wget curl nano ufw software-properties-common dirmngr apt-transport-https gnupg2 ca-certificates lsb-release debian-archive-keyring unzip -y
  2. Add the OpenLiteSpeed repository for Debian 12:
    sudo wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash
  3. Install OpenLiteSpeed:
    sudo apt update
    sudo apt install openlitespeed

Step 3: Create the Administrator Password

  1. Access the OpenLiteSpeed WebGUI at http://your-server-ip:7080.
  2. Set an admin username and password.

Step 4: Install PHP

  1. Enable the LiteSpeed repository for PHP:
    sudo wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_php_repo.sh | bash
  2. Install PHP:
    sudo apt update
    sudo apt install lsphp74

Step 5: Configure MariaDB

  1. Install MariaDB:
    sudo apt install mariadb-server
  2. Secure MariaDB installation:
    sudo mysql_secure_installation

Step 6: Configure OpenLiteSpeed

  1. Switch the HTTP port back to 80:
  • In the WebGUI, navigate to Configuration > Listeners.
  • Edit the Default listener and set the port to 80.
  1. Configure PHP:
  • In the WebGUI, navigate to Configuration > Server > General.
  • Set the External App for PHP to lsphp74.
  1. Restart PHP:
    sudo systemctl restart lsws

Step 7: Create VirtualHost

  1. In the WebGUI, navigate to Virtual Hosts > Add a Virtual Host.
  2. Configure your website settings.

Step 8: Install SSL

  1. Obtain an SSL certificate (e.g., Let’s Encrypt).
  2. In the WebGUI, navigate to Virtual Hosts > your-virtual-host > SSL.
  3. Upload your SSL certificate files.

Step 9: Test Site

  1. Upload your website files to the configured VirtualHost directory.
  2. Access your site via the FQDN or IP address.

Congratulations! You’ve successfully installed and configured LiteSpeed Web Server on Debian 12. Enjoy the improved performance!