--- title: "How to Install OpenLiteSpeed with PHP on Ubuntu 24.04" description: "Install OpenLiteSpeed and LSPHP 8.3 on Ubuntu 24.04 from the official repository, add a virtual host on port 80 and secure it with a Let's Encrypt certificate." category: "Control Panels and Management" language: en source: https://cubepath.com/docs/control-panels-and-management/openlitespeed-installation-and-configuration updated: 2026-09-25 --- # How to Install OpenLiteSpeed with PHP on Ubuntu 24.04 OpenLiteSpeed is the open source edition of LiteSpeed Web Server. It is event driven, runs PHP through its fast LSAPI interface, reads Apache-style rewrite rules from `.htaccess` and includes a built-in page cache (LSCache). It is configured from a web console called WebAdmin. In this tutorial you will install OpenLiteSpeed and PHP 8.3 on Ubuntu 24.04 from the LiteSpeed repository, serve a site on port 80 with its own virtual host, and secure it with a Let's Encrypt certificate. ## Prerequisites To follow this guide you need: - A server running Ubuntu 24.04 LTS, for example a CubePath VPS, with at least 1 GB of RAM. - A non-root user with `sudo` privileges and UFW enabled with SSH allowed. - No other web server listening on ports 80 or 443. If Apache or Nginx is installed, stop and disable it first. - A domain name, `your_domain` in this guide, with A records for `your_domain` and `www.your_domain` pointing to `your_server_ip`. ## Step 1 - Adding the LiteSpeed repository OpenLiteSpeed and its PHP builds (LSPHP) are distributed from LiteSpeed's own apt repository. The vendor provides a small script that detects your distribution, installs the repository signing keys and writes the source list. Download it and review it before running it: ```bash curl -fsSL -o litespeed-repo.sh https://repo.litespeed.sh less litespeed-repo.sh ``` Run it: ```bash sudo bash litespeed-repo.sh ``` Check that the repository was added and that apt can see the package: ```bash cat /etc/apt/sources.list.d/lst_debian_repo.list apt-cache policy openlitespeed ``` ```output deb http://rpms.litespeedtech.com/debian/ noble main #deb http://rpms.litespeedtech.com/edge/debian/ noble main openlitespeed: Installed: (none) Candidate: 1.9.2-1+noble ``` The repository uses plain HTTP, but apt verifies every package with the LiteSpeed signing keys the script installed. ## Step 2 - Installing OpenLiteSpeed and PHP The `openlitespeed` package depends on LSPHP 8.3 (`lsphp83`, `lsphp83-common` and `lsphp83-mysql`), which becomes the default PHP handler. Install it together with a few extensions most PHP applications need: ```bash sudo apt update sudo apt install openlitespeed lsphp83-curl lsphp83-intl ``` Everything is installed under `/usr/local/lsws`. During installation the package prints a random password for the WebAdmin console: ```output WebAdmin user/password is admin/Xk3v9QpL2mRt7bYz ``` The service is enabled and started automatically. The systemd unit is `lshttpd`, with `lsws` as an alias. Check it: ```bash sudo systemctl status lsws --no-pager ``` ```output ● lshttpd.service - OpenLiteSpeed HTTP Server Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; preset: enabled) Active: active (running) since Thu 2026-09-25 13:40:12 UTC; 30s ago ``` Out of the box, OpenLiteSpeed serves an example site on port 8088 and WebAdmin on port 7080. Confirm the example site answers locally: ```bash curl -sI http://localhost:8088 | head -n 3 ``` ```output HTTP/1.1 200 OK etag: "5ab-68d4c2a1-2c1b" content-type: text/html ``` ## Step 3 - Configuring the firewall Open HTTP and HTTPS for your sites, and open the WebAdmin port only to the IP you administer the server from. Replace `your_admin_ip` with that address: ```bash sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw allow from your_admin_ip to any port 7080 proto tcp ``` Port 8088 stays closed; you will not need the example site. ```bash sudo ufw status ``` ```output To Action From -- ------ ---- OpenSSH ALLOW Anywhere 80/tcp ALLOW Anywhere 443/tcp ALLOW Anywhere 7080/tcp ALLOW your_admin_ip ``` ## Step 4 - Setting the WebAdmin password If you did not save the password shown during installation, it is also stored in a root-only file: ```bash sudo cat /usr/local/lsws/adminpasswd ``` Replace it with your own password using the bundled script. It asks for a user name (press Enter to keep `admin`) and the new password twice: ```bash sudo /usr/local/lsws/admin/misc/admpass.sh ``` Then delete the file with the old random password: ```bash sudo rm /usr/local/lsws/adminpasswd ``` Open `https://your_server_ip:7080` and log in as `admin`. WebAdmin uses a self-signed certificate, so accept the browser warning. ## Step 5 - Creating the document root Create a directory for the site and a small PHP file to test the setup. OpenLiteSpeed runs PHP as the `nobody` user by default, so the files must be readable by others: ```bash sudo mkdir -p /var/www/your_domain/html sudo chown -R "$USER":"$USER" /var/www/your_domain ``` Create a test page: ```bash nano /var/www/your_domain/html/index.php ``` ```php Add**: | Field | Value | |---|---| | Listener Name | `HTTPS` | | IP Address | `ANY IPv4` | | Port | `443` | | Secure | `Yes` | Save, then open the `HTTPS` listener: 1. **General** tab, **Virtual Host Mappings**: add `your_domain` with domains `your_domain, www.your_domain`. 2. **SSL** tab, **SSL Private Key & Certificate**: set **Private Key File** to `/etc/letsencrypt/live/your_domain/privkey.pem`, **Certificate File** to `/etc/letsencrypt/live/your_domain/fullchain.pem` and **Chained Certificate** to `Yes`. To redirect all HTTP traffic to HTTPS, open the virtual host, go to the **Rewrite** tab and add these **Rewrite Rules**: ```apache RewriteCond %{SERVER_PORT} 80 RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] ``` Restart gracefully and test both schemes: ```bash sudo /usr/local/lsws/bin/lswsctrl restart curl -sI http://your_domain | head -n 2 curl -sI https://your_domain | head -n 1 ``` ```output HTTP/1.1 301 Moved Permanently location: https://your_domain/ HTTP/2 200 ``` OpenLiteSpeed only loads certificates at startup, so it must be restarted after every renewal. Create a Certbot deploy hook: ```bash sudo nano /etc/letsencrypt/renewal-hooks/deploy/openlitespeed.sh ``` ```bash #!/usr/bin/env bash set -euo pipefail /usr/local/lsws/bin/lswsctrl restart ``` Make it executable and test renewal: ```bash sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/openlitespeed.sh sudo certbot renew --dry-run ``` ## Step 9 - Adjusting PHP settings LSPHP has its own `php.ini`, separate from any system PHP. The package creates it from the production template in the LSPHP directory: ```bash ls -l /usr/local/lsws/lsphp83/etc/php/8.3/litespeed/php.ini ``` ```output -rw-r--r-- 1 root root 73012 Sep 25 13:39 /usr/local/lsws/lsphp83/etc/php/8.3/litespeed/php.ini ``` Edit it to raise common limits, for example for uploads: ```bash sudo nano /usr/local/lsws/lsphp83/etc/php/8.3/litespeed/php.ini ``` ```ini memory_limit = 256M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 60 ``` LSPHP processes read `php.ini` when they start, so restart OpenLiteSpeed to apply the changes: ```bash sudo /usr/local/lsws/bin/lswsctrl restart ``` ## Step 10 - Using LSCache The cache module is enabled at server level in the default configuration, but it only stores pages when the application tells it to. For WordPress, install the **LiteSpeed Cache** plugin, which sends the right cache headers and purges pages when content changes. For other applications, LiteSpeed publishes LSCache plugins for platforms such as Drupal, Joomla and Laravel. Check that a page is served from cache by looking for the `x-litespeed-cache: hit` header on a second request: ```bash curl -sI https://your_domain | grep -i x-litespeed-cache ``` ## Troubleshooting - **Port 80 already in use after installation**: another web server is running. Stop it with `sudo systemctl disable --now apache2` (or `nginx`) and restart OpenLiteSpeed. - **404 on every page**: the listener has no mapping for the host name you requested. Check **Virtual Host Mappings** in the listener and include both `your_domain` and `www.your_domain`. - **PHP code is downloaded instead of executed**: **Enable Scripts/ExtApps** is set to `No` on the virtual host. Change it, then restart. - **Configuration changes have no effect**: WebAdmin saves the files but does not apply them. Perform a graceful restart after each change. Errors are logged in `/usr/local/lsws/logs/error.log`. ## Conclusion You installed OpenLiteSpeed with PHP 8.3 on Ubuntu 24.04, created a virtual host served on ports 80 and 443 with a Let's Encrypt certificate and automatic renewal, and learned where to tune PHP. From here you can install MariaDB and deploy WordPress with the LiteSpeed Cache plugin, add more virtual hosts by repeating Steps 5 to 7, and review the access logs in `/usr/local/lsws/logs/` to confirm traffic reaches the right site.