Install and Configure OpenLiteSpeed on Ubuntu 20.04
OpenLiteSpeed is a powerful, open-source web server designed for high performance. It supports modern protocols such as HTTP/2 and HTTP/3 and integrates seamlessly with PHP to deliver dynamic applications securely. In addition, it provides an intuitive web-based administration panel for managing virtual hosts with ease.
This guide walks you through installing OpenLiteSpeed on Ubuntu 20.04 and configuring its web administration console to safely serve web applications from your server.
Prerequisites
Before proceeding, ensure that you have the following in place:
- An Ubuntu 20.04 server.
- A new A record for your domain pointing to the server’s IP address.
- SSH access to the server as a non-root user with sudo rights.
- Updated system packages.
Install OpenLiteSpeed
Since OpenLiteSpeed is not included in the standard Ubuntu 20.04 APT repositories, you will need to add its repository manually. Follow these steps:
Step 1: Download the Repository Script
$ wget -O openlitespeed.sh https://repo.litespeed.sh
Step 2: Run the Repository Setup Script
$ sudo bash openlitespeed.sh
Expected output:
LiteSpeed repository has been setup!
Step 3: Install OpenLiteSpeed
$ sudo apt install openlitespeed -y
Step 4: Verify the Installed Version
$ cat /usr/local/lsws/VERSION
Your output should resemble:
1.8.2
Manage the OpenLiteSpeed System Service
OpenLiteSpeed uses the lshttpd.service system service, also referred to as lsws, to control its processes. Use the following commands to enable and manage the service:
Enable the Service at Boot
$ sudo systemctl enable lshttpd.service
Start the Service
$ sudo systemctl start lsws
Check Service Status
$ sudo systemctl status lsws
Example output:
● lshttpd.service - OpenLiteSpeed HTTP Server
Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2025-04-06 09:44:35 UTC; 1min 5s ago
Main PID: 5638 (litespeed)
CGroup: /system.slice/lshttpd.service
├─5638 openlitespeed (lshttpd - main)
├─5648 openlitespeed (lscgid)
├─5677 openlitespeed (lshttpd - #01)
├─5678 openlitespeed (lshttpd - #02)
├─5679 openlitespeed (lshttpd - #03)
└─5680 openlitespeed (lshttpd - #04)
Stop the Service
$ sudo systemctl stop lsws
Restart the Service
$ sudo systemctl restart lsws
Access the OpenLiteSpeed Web Administration Console
By default, the administration interface is available on port 7080. The default administrator password is stored in /usr/local/lsws/admin/password. Follow these steps to configure access and secure your setup:
Set a New Admin User and Password
$ sudo bash /usr/local/lsws/admin/misc/admpass.sh
Follow the prompts to define a username and a strong password. Once completed, you should see:
Administrator’s username/password is updated successfully!
Allow Firewall Access to Port 7080
$ sudo ufw allow 7080/tcp
$ sudo ufw reload
Log in to the Admin Console
In a web browser, navigate to:
http://SERVER-IP:7080
Accept the SSL warning and enter the new username and password you set earlier.
Change the Default Listener Port
To configure OpenLiteSpeed to serve websites on HTTP port 80:
- Click Listeners in the admin dashboard.
- Open the Default listener profile via the view icon.
- Edit the Address Settings section and change the port from
8088to80. - Save your changes.
- Confirm the prompt that configurations have been modified.
- Click the Graceful Restart icon next to the LSWS PID to apply changes.
After applying these steps, OpenLiteSpeed will be running on port 80 and ready to serve web applications.
Create a New OpenLiteSpeed Virtual Host
OpenLiteSpeed enables you to create virtual hosts via its web-based administration console. To set up a new one, log in, go to Listeners, and add a virtual host. Define the domain (e.g., app.example.com) and the web root directory (e.g., /var/www/app.example.com). Save the configuration, map the domain to the virtual host in the listener settings, and restart the server for changes to take effect.
Prepare the Virtual Host Directories
Create the web root directory for the new virtual host:
$ sudo mkdir /usr/local/lsws/app.example.com
Create the required subdirectories (html, logs, and conf):
$ sudo mkdir /usr/local/lsws/app.example.com/{html,logs,conf} -p
- html: Stores the application files.
- logs: Contains access and error logs.
- conf: Holds site-specific OpenLiteSpeed configurations.
Grant full ownership of the directory to the lsadm user and group:
$ sudo chown lsadm:lsadm -R /usr/local/lsws/app.example.com/
Configure the Virtual Host in the Admin Console
Access the admin console at:
http://SERVER-IP:7080
Navigate to Virtual Hosts and click + Add. Enter the following values (replace app.example.com with your domain):
- Virtual Host Name:
app.example.com - Virtual Host Root:
$SERVER_ROOT/app.example.com/ - Config File:
$SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf - Follow Symbolic Link: Yes
- Enable Scripts/ExtApps: Yes
- Restrained: Yes
- External App Set UID Mode: Server UID
Click Save. If you see an error, click CLICK TO CREATE to generate the vhconf.conf file, then save again.
Modify Virtual Host General Settings
In the General tab:
- Document Root:
$VH_ROOT/html/ - Domain Name:
app.example.com - Enable GZIP Compression: Yes
- Enable Brotli Compression: Yes
Configure Logging
In the Log tab:
- Error Log: Use Server’s Log: Yes, File:
$VH_ROOT/logs/error.log, Level: ERROR, Rolling Size: 10M, Keep Days: 30. - Access Log: Control: Own Log File, File:
$VH_ROOT/logs/access.log, Rolling Size: 10M, Keep Days: 30.
Enable Rewrite Rules
In the Rewrite tab, set:
- Enable Rewrite: Yes
- Auto Load from .htaccess: Yes
Bind the Virtual Host to the Listener
Go to Listeners, edit the Default Listener, and add a mapping:
- Virtual Host: Select your host profile
- Domains:
app.example.com
Save the changes and click Graceful Restart to apply them.
Create a Test HTML Page
SSH into the server:
$ ssh exampleuser@SERVER-IP
Create an index.html file:
$ sudo nano /usr/local/lsws/app.example.com/html/index.html
Insert this content:
Greetings from centron!
Save and exit. This file displays “Greetings from centron” when accessed.
Allow HTTP traffic through the firewall:
$ sudo ufw allow 80/tcp
Open http://app.example.com in a browser to confirm your site works.
Secure the OpenLiteSpeed Server with SSL
By default, OpenLiteSpeed serves content via HTTP (port 80). To secure it with HTTPS (port 443), generate and configure a Let’s Encrypt SSL certificate.
Install Certbot
$ sudo snap install --classic certbot
Generate SSL Certificate
$ sudo certbot certonly --webroot -w /usr/local/lsws/app.example.com/html/ --agree-tos --no-eff-email --staple-ocsp --preferred-challenges http -m name@example.com -d app.example.com
Once complete, certificates are stored in /etc/letsencrypt/live/app.example.com/. Example output:
- Certificate:
fullchain.pem - Key:
privkey.pem
Test renewal:
$ sudo certbot renew --dry-run
Configure SSL in OpenLiteSpeed
In the admin console:
- Go to Listeners and add a new listener with:
- Name: HTTPS
- IP Address: ANY IPv4
- Port: 443
- Secure: Yes
- Map it to your virtual host (
app.example.com). - In the SSL tab, set:
- Private Key:
/etc/letsencrypt/live/app.example.com/privkey.pem - Certificate:
/etc/letsencrypt/live/app.example.com/fullchain.pem - Chained Certificate: Yes
- Private Key:
- Click Graceful Restart to apply.
Note: If you run multiple virtual hosts, configure SSL separately for each one.
Set Up Firewall Rules
Ensure UFW is active and allows necessary ports:
Enable SSH, Admin, HTTP, and HTTPS
$ sudo ufw allow 22/tcp && sudo ufw enable
$ sudo ufw allow 7080/tcp
$ sudo ufw allow http
$ sudo ufw allow https
$ sudo ufw reload
Check the status:
$ sudo ufw status
Now, open https://app.example.com in a browser to confirm your SSL setup.
Conclusion
You have successfully installed OpenLiteSpeed on Ubuntu 20.04, configured a sample virtual host, and secured it with SSL. With PHP support built-in, OpenLiteSpeed is now ready to serve dynamic web applications efficiently.


