Web Hosting

Install OpenLiteSpeed Web Server on Ubuntu 24.04

OpenLiteSpeed is a high-performance, open-source HTTP server built by LiteSpeed Technologies. It uses an event-driven architecture that handles thousands of concurrent connections with minimal resource usage – making it a strong alternative to Nginx and Apache for production workloads. OpenLiteSpeed ships with a built-in WebAdmin GUI, native PHP processing through LSAPI, HTTP/3 and QUIC support, mod_rewrite compatibility, and a page cache module that accelerates WordPress sites significantly.

Original content from computingforgeeks.com - post 65525

This guide walks through installing OpenLiteSpeed 1.8.x on Ubuntu 24.04 LTS from the official repository, configuring PHP via LSPHP, setting up virtual hosts, SSL/TLS, firewall rules, and hosting a WordPress site. Every step includes verification commands so you can confirm each part works before moving on.

Prerequisites

Before starting, make sure you have the following in place:

  • A server running Ubuntu 24.04 LTS with at least 1GB RAM and 1 CPU core (2GB+ recommended for WordPress)
  • Root or sudo access to the server
  • A registered domain name pointed to your server’s public IP (for SSL setup)
  • Ports 80, 443, 7080, and 8088 available (not used by another web server)

Switch to the root user for the rest of this guide:

sudo -i

Step 1: Install OpenLiteSpeed on Ubuntu 24.04

OpenLiteSpeed provides an official repository that makes installation straightforward on Ubuntu. Start by adding the LiteSpeed repository to your system.

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

The script adds the LiteSpeed GPG key and repository configuration. Once complete, install OpenLiteSpeed:

apt update
apt install openlitespeed -y

After installation, OpenLiteSpeed is installed under /usr/local/lsws/. Start and enable the service so it runs on boot:

systemctl start lsws
systemctl enable lsws

Verify the service is running:

systemctl status lsws

The output should show the service as active (running):

● lshttpd.service - OpenLiteSpeed HTTP Server
     Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; preset: enabled)
     Active: active (running)

Check the installed version to confirm everything is in order:

/usr/local/lsws/bin/lshttpd -v

You should see the OpenLiteSpeed version printed – 1.8.x at the time of writing:

LiteSpeed/1.8.5 Open (BUILD built: ...)

Step 2: Install PHP (LSPHP) on Ubuntu 24.04

OpenLiteSpeed uses its own PHP build called LSPHP (LiteSpeed PHP), which communicates through the high-performance LSAPI protocol. This is faster than PHP-FPM because it avoids the overhead of socket-based communication. Install LSPHP 8.4 along with commonly needed extensions:

apt install lsphp84 lsphp84-common lsphp84-mysql lsphp84-curl lsphp84-imagick lsphp84-imap lsphp84-intl lsphp84-opcache -y

Verify the PHP installation by checking the version:

/usr/local/lsws/lsphp84/bin/php -v

The output confirms the LSPHP version and the LiteSpeed SAPI:

PHP 8.4.x (litespeed) (built: ...)
Copyright (c) The PHP Group

To see all available LSPHP packages and extensions in the repository, run:

apt-cache search lsphp84

This lists every extension available for LSPHP 8.4. Install additional ones as needed for your application.

Step 3: Access the OpenLiteSpeed Admin Panel

OpenLiteSpeed ships with a web-based admin panel that runs on port 7080. Before accessing it, set the admin password. The default username is admin.

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

The script prompts you to enter and confirm a new password. After setting it, access the admin panel in your browser:

https://your-server-ip:7080

Accept the self-signed SSL certificate warning and log in with username admin and the password you just set. The dashboard gives you an overview of server status, listeners, virtual hosts, and real-time traffic stats.

By default, OpenLiteSpeed serves a test page on port 8088. Verify it works by visiting http://your-server-ip:8088 in your browser. You should see the OpenLiteSpeed congratulations page.

Step 4: Configure Virtual Hosts in OpenLiteSpeed

Virtual hosts let you serve multiple websites from a single OpenLiteSpeed instance. Each virtual host has its own document root, logs, and configuration. Create the directory structure for your site first.

mkdir -p /var/www/example.com/{html,logs}
chown -R nobody:nogroup /var/www/example.com/html

OpenLiteSpeed runs as the nobody user by default, so the document root needs proper ownership. Create a test page to verify the virtual host works:

echo '<h1>OpenLiteSpeed Virtual Host Works</h1>' > /var/www/example.com/html/index.html

Now configure the virtual host through the WebAdmin panel:

  • Log in to the admin panel at https://your-server-ip:7080
  • Go to Virtual Hosts and click the + button to add a new virtual host
  • Set Virtual Host Name to example.com
  • Set Virtual Host Root to /var/www/example.com/
  • Set Config File to $SERVER_ROOT/conf/vhosts/example.com/vhconf.conf
  • Check Enable Scripts/ExtApps to Yes
  • Click Save – if the config file doesn’t exist, click the link to create it

After creating the virtual host, configure its document root:

  • Click on the new virtual host name to edit it
  • Under General, set Document Root to /var/www/example.com/html/
  • Set Domain Name to example.com
  • Click Save

Next, add a listener to route traffic to this virtual host. Go to Listeners in the admin panel:

  • Click on the Default listener (port 8088) or create a new one on port 80
  • Under Virtual Host Mappings, click + to add a mapping
  • Select your virtual host (example.com) and set the domain to example.com
  • Click Save

Click Graceful Restart (the green restart icon) to apply the configuration changes. OpenLiteSpeed restarts without dropping active connections.

Step 5: Configure PHP Handler in OpenLiteSpeed

OpenLiteSpeed needs to know which LSPHP binary to use for processing PHP files. By default, it may point to an older version. Update it to use LSPHP 8.4 that we installed earlier.

In the WebAdmin panel:

  • Go to Server Configuration then External App
  • Find the lsphp entry and click Edit
  • Update the Command field to: /usr/local/lsws/lsphp84/bin/lsphp
  • Click Save

Alternatively, configure the PHP handler through the command line by editing the server configuration file:

vi /usr/local/lsws/conf/httpd_config.conf

Find the extprocessor lsphp section and update the command path:

extprocessor lsphp {
  type                    lsapi
  address                 uds://tmp/lshttpd/lsphp.sock
  maxConns                10
  env                     PHP_LSAPI_CHILDREN=10
  env                     LSAPI_AVOID_FORK=200M
  initTimeout             60
  retryTimeout            0
  pcKeepAliveTimeout      15
  respBuffer              0
  autoStart               2
  path                    /usr/local/lsws/lsphp84/bin/lsphp
  backlog                 100
  instances               1
  priority                0
  memSoftLimit            2047M
  memHardLimit            2047M
  procSoftLimit           1400
  procHardLimit           1500
}

After saving the file, perform a graceful restart to apply the change:

/usr/local/lsws/bin/lswsctrl restart

Verify PHP is working by creating a test file in your document root:

echo '<?php phpinfo(); ?>' > /var/www/example.com/html/info.php

Visit http://your-server-ip:8088/info.php in your browser. You should see the PHP info page showing the LiteSpeed SAPI and PHP 8.4.x. Remove the test file after verifying:

rm /var/www/example.com/html/info.php

Step 6: Configure SSL/TLS for OpenLiteSpeed

OpenLiteSpeed has built-in SSL support with HTTP/3 and QUIC. For production use, get a free SSL certificate from Let’s Encrypt using Certbot. If you need a detailed walkthrough on generating Let’s Encrypt certificates on Linux, check that guide first.

Install Certbot:

apt install certbot -y

Stop OpenLiteSpeed temporarily so Certbot can bind to port 80 for domain verification:

systemctl stop lsws
certbot certonly --standalone -d example.com -d www.example.com
systemctl start lsws

Certbot stores the certificates under /etc/letsencrypt/live/example.com/. Now configure OpenLiteSpeed to use them. In the WebAdmin panel:

  • Go to Listeners and click + to add a new listener
  • Set Listener Name to HTTPS
  • Set Port to 443
  • Set Secure to Yes
  • Click Save

After creating the listener, configure the SSL certificate:

  • Click on the HTTPS listener and go to the SSL tab
  • Set Private Key File to /etc/letsencrypt/live/example.com/privkey.pem
  • Set Certificate File to /etc/letsencrypt/live/example.com/fullchain.pem
  • Under SSL Protocol, enable TLS v1.2 and TLS v1.3 only (disable older versions)
  • Click Save

Add a virtual host mapping to the HTTPS listener the same way you did for the HTTP listener – map your domain to the virtual host. Click Graceful Restart to apply.

Set up automatic certificate renewal by adding a cron job:

crontab -e

Add the following line to renew certificates and restart OpenLiteSpeed automatically:

0 3 * * * certbot renew --quiet --pre-hook "systemctl stop lsws" --post-hook "systemctl start lsws"

Step 7: Configure Firewall for OpenLiteSpeed

OpenLiteSpeed uses several ports that need to be open in your firewall. Here is a summary of the required ports:

PortProtocolPurpose
80TCPHTTP traffic
443TCP/UDPHTTPS and HTTP/3 (QUIC)
7080TCPWebAdmin panel
8088TCPDefault test page (remove in production)

If you are using UFW (the default firewall on Ubuntu), open the required ports. For a detailed guide on UFW firewall commands, see that reference.

ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 443/udp
ufw allow 7080/tcp
ufw enable

Verify the firewall rules are active:

ufw status numbered

You should see all four ports listed as ALLOW:

Status: active

     To                         Action      From
     --                         ------      ----
[ 1] 80/tcp                     ALLOW IN    Anywhere
[ 2] 443/tcp                    ALLOW IN    Anywhere
[ 3] 443/udp                    ALLOW IN    Anywhere
[ 4] 7080/tcp                   ALLOW IN    Anywhere

For production environments, restrict port 7080 to your management IP only to prevent unauthorized access to the admin panel:

ufw delete allow 7080/tcp
ufw allow from 192.168.1.100 to any port 7080 proto tcp

Replace 192.168.1.100 with your actual management IP address. Remove the port 8088 rule once you have verified your virtual host is working on port 80/443.

Step 8: Host WordPress on OpenLiteSpeed

OpenLiteSpeed is one of the fastest web servers for running WordPress thanks to its built-in LSCache module. If you already have a WordPress installation running on Nginx or Apache on Ubuntu, the migration to OpenLiteSpeed is straightforward.

First, install MariaDB as the database backend. We have a dedicated guide on installing MariaDB on Ubuntu 24.04 if you need the full setup. For a quick install:

apt install mariadb-server mariadb-client -y
systemctl enable --now mariadb
mysql_secure_installation

Create a database and user for WordPress:

mysql -u root -p

Run the following SQL commands to create the database, user, and grant permissions:

CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download and extract WordPress into your virtual host document root:

cd /var/www/example.com/html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
mv wordpress/* .
rm -rf wordpress latest.tar.gz
chown -R nobody:nogroup /var/www/example.com/html

Configure WordPress by copying the sample configuration file:

cp wp-config-sample.php wp-config.php
vi wp-config.php

Update the database connection settings with the credentials you created:

define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'StrongPassword123!' );
define( 'DB_HOST', 'localhost' );

Next, enable the rewrite module for WordPress permalinks. In the WebAdmin panel, go to your virtual host configuration:

  • Click on your virtual host and go to the Rewrite tab
  • Set Enable Rewrite to Yes
  • Set Auto Load from .htaccess to Yes
  • Click Save and do a Graceful Restart

You can also add the rewrite rules directly. Under Rewrite Rules, add:

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Visit your domain in the browser to complete the WordPress installation wizard. After installation, install the LiteSpeed Cache plugin from the WordPress plugin repository – it integrates directly with OpenLiteSpeed’s built-in cache engine for significant performance gains.

Step 9: OpenLiteSpeed vs Nginx vs Apache – Comparison

Choosing between web servers depends on your workload, team expertise, and performance requirements. Here is a practical comparison based on real-world production use.

FeatureOpenLiteSpeedNginxApache
ArchitectureEvent-drivenEvent-drivenProcess/Thread-based
PHP IntegrationLSAPI (native, fastest)PHP-FPM (socket)mod_php or PHP-FPM
Built-in CacheYes (LSCache)No (needs FastCGI cache or proxy)No (needs Varnish/plugins)
.htaccess SupportYes (mod_rewrite compatible)No (uses own config syntax)Yes (native)
HTTP/3 (QUIC)Yes (built-in)Yes (since 1.25.0)No (requires mod_http3)
Admin GUIYes (WebAdmin on port 7080)No (config files only)No (config files only)
WordPress PerformanceExcellent with LSCache pluginGood with FastCGI cacheAdequate with caching plugins
Memory UsageLowLowHigher under load
Config ComplexityLow (GUI + .htaccess)Medium (custom syntax)Low (.htaccess familiar)
Community/EcosystemSmaller but growingVery largeLargest

OpenLiteSpeed stands out for WordPress hosting specifically. The native LSAPI protocol processes PHP requests up to 50% faster than PHP-FPM according to LiteSpeed’s benchmarks. The built-in page cache eliminates the need for separate caching layers like Varnish or Redis page cache. Apache migration is also simpler because OpenLiteSpeed reads .htaccess rewrite rules directly – no need to convert them to Nginx syntax.

Nginx remains the better choice for pure reverse proxy or load balancing scenarios where PHP processing is handled by backend servers. Apache is the safe default if your team already manages Apache infrastructure and you need maximum ecosystem compatibility.

Conclusion

You now have OpenLiteSpeed running on Ubuntu 24.04 with PHP 8.4, SSL/TLS, and WordPress ready to serve traffic. The WebAdmin GUI on port 7080 handles most day-to-day configuration changes without touching config files directly.

For production hardening, restrict the admin panel to your management IP, enable ModSecurity v3 for web application firewall protection, set up automated backups of /usr/local/lsws/conf/ and your document roots, and monitor server resources through the OpenLiteSpeed real-time stats dashboard or an external monitoring stack.

Related Articles

Programming Install Swift Programming Language on Ubuntu 24.04 Debian How to run Linux on Android without root using UserLAnd Ubuntu Install Ubuntu 20.04 Desktop – Full Steps With Screenshots Docker Install Docker Registry on Ubuntu 24.04|22.04|20.04

1 thought on “Install OpenLiteSpeed Web Server on Ubuntu 24.04”

Leave a Comment

Press ESC to close