Installing OpenLiteSpeed on Ubuntu 22.04
OpenLiteSpeed is a free and open-source web server known for its high performance and support for multiple connection protocols such as HTTP/2 and HTTP/3. It includes native PHP integration for securely delivering dynamic web applications. The platform also offers a user-friendly graphical administration interface that makes it simple to manage and create multiple virtual hosts on your server.
This guide explains how to install OpenLiteSpeed on Ubuntu 22.04 and set up the web administration console to securely host applications on your server.
Prerequisites
Before starting, ensure that you have the following:
- An Ubuntu 22.04 server.
- A domain name A record that points to your server’s IP address.
- SSH access as a non-root user with sudo privileges.
- The system updated to the latest packages.
Install OpenLiteSpeed
OpenLiteSpeed is not part of the default Ubuntu 22.04 APT repositories. To install it, you must use the latest repository setup script. Follow these instructions to download and execute the script so that the web server can be installed via APT.
Download the Latest Repository Setup Script
$ wget -O openlitespeed.sh https://repo.litespeed.sh
Run the Script to Add Repository Information
$ sudo bash openlitespeed.sh
Output:
LiteSpeed repository has been setup!
Install OpenLiteSpeed
$ sudo apt install openlitespeed -y
Verify the Installed Version
$ cat /usr/local/lsws/VERSION
Your output should look similar to:
1.8.2
Manage the OpenLiteSpeed System Service
OpenLiteSpeed uses the lshttpd.service system service, also known as lsws, to manage web server processes via systemd. Use the following commands to enable the service at boot, start it manually, and check its status.
Enable Service at Boot
$ sudo systemctl enable lshttpd.service
Start the Service
$ sudo systemctl start lsws
Check the Service Status
$ sudo systemctl status lsws
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
The OpenLiteSpeed admin console runs on port 7080, and its default admin credentials are stored in /usr/local/lsws/admin/password. Follow these instructions to enable access, update your credentials, and configure OpenLiteSpeed to serve web applications over HTTP port 80.
Set Up an Admin Username and Password
$ sudo bash /usr/local/lsws/admin/misc/admpass.sh
Enter a new username when prompted and press Enter.
Then, create a strong password and confirm it to save your administrative credentials.
Output:
Administrator’s username/password is updated successfully!
Allow Admin Port Through Firewall
$ sudo ufw allow 7080/tcp
Reload UFW Rules
$ sudo ufw reload
Access the Admin Console
Open a browser and go to http://SERVER-IP:7080. Accept the insecure SSL warning, then log in using the credentials you just created.
USERNAME: <username you set earlier>
PASSWORD: <password you set earlier>
Modify the Default Listener Port
Once logged in, click Listeners in the navigation bar, then choose the view icon beside the Default listener profile. Click Edit in the Address Settings section to modify the listener configuration. Change the port from 8088 to 80 so that your default virtual hosts run on HTTP port 80.
Click the Save icon to save your configuration. A message confirming configuration changes will appear. Locate the LSWS PID in the top right and click the Graceful Restart icon to apply your updates.
When prompted, click Go to restart the OpenLiteSpeed server.
Restart LiteSpeed
Create a New OpenLiteSpeed Virtual Host
OpenLiteSpeed enables you to define virtual hosts with custom web root directories through its administration console. Follow these instructions to create a virtual host for the domain app.example.com and assign it a unique web root directory on your server.
Create a Web Root Directory
Start by creating a new directory that will act as your virtual host’s root. For example, use /usr/local/lsws/app.example.com.
$ sudo mkdir /usr/local/lsws/app.example.com
Create Required Subdirectories
Next, add the html, logs, and conf subdirectories inside your web root folder. These are necessary for OpenLiteSpeed to store website data and configurations.
$ sudo mkdir /usr/local/lsws/app.example.com/{html,logs,conf} -p
This command creates the following structure:
- html – contains website and application files served through OpenLiteSpeed.
- logs – stores access and error logs.
- conf – holds configuration files specific to this virtual host.
Set Directory Permissions
Grant full access to the OpenLiteSpeed administration user lsadm for the directory and all its contents.
$ sudo chown lsadm:lsadm -R /usr/local/lsws/app.example.com/
Configure the Virtual Host via Web Console
Open your OpenLiteSpeed admin console at:
http://SERVER-IP:7080
Click Virtual Hosts in the sidebar, then choose + Add to create a new host entry.
Enter Virtual Host Information
Fill in the following details (replace app.example.com with your actual 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 to apply. If an error message appears asking to create vhconf.conf, click CLICK TO CREATE and then save again.
Afterward, verify your new virtual host appears in the summary. Select View to edit its configuration.
Edit the General Configuration
Under the General tab, choose Edit and update the following:
- Document Root: $VH_ROOT/html/
- Domain Name: app.example.com
- Enable GZIP Compression: Yes
- Enable Brotli Compression: Yes
Click Save to confirm.
Configure Log Settings
Go to the Log tab and click Edit in the Virtual Host Log section. Use the following values:
- Use Server’s Log: Yes
- File Name: $VH_ROOT/logs/error.log
- Log Level: ERROR
- Rolling Size (bytes): 10M
- Keep Days: 30
Click Save to store changes, then click Add under the Access Log section and configure the following:
- Log Control: Own Log File
- File Name: $VH_ROOT/logs/access.log
- Rolling Size (bytes): 10M
- Keep Days: 30
Set Rewrite Options
Open the Rewrite tab, click Edit under the Rewrite Control section, and set:
- Enable Rewrite: Yes
- Auto Load from .htaccess: Yes
Click Save to apply changes.
Map the Virtual Host to a Listener
From the top menu, open Listeners. Edit the Default Listener and click Add under Virtual Host Mappings.
Select your virtual host, enter app.example.com under Domains, save, and perform a Graceful Restart to activate the configuration.
Test the Virtual Host
Connect to your server via SSH:
$ ssh exampleuser@SERVER-IP
Create a test HTML file named index.html in your html directory:
$ sudo nano /usr/local/lsws/app.example.com/html/index.html
Add this content to the file:
    
Greetings from centron!
 
Save and exit. This will display a “Greetings from centron!” message when accessed in your browser.
Allow HTTP Access
Enable HTTP traffic through the firewall:
$ sudo ufw allow 80/tcp
Visit http://app.example.com in a browser to confirm that your virtual host displays correctly.
Secure the OpenLiteSpeed Web Server
By default, OpenLiteSpeed serves content over HTTP (port 80), which is unencrypted. To secure your site, enable HTTPS on port 443 using SSL certificates. The following steps explain how to generate and configure a trusted Let’s Encrypt certificate.
Install Certbot
Use Snap to install the Certbot client:
$ sudo snap install --classic certbot
Generate an SSL Certificate
Run the following command to generate an SSL certificate via HTTP-01 challenge. Replace with your actual domain and email address:
$ 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
This creates a Let’s Encrypt SSL certificate for app.example.com using the defined web root directory. You’ll need to manually enable this certificate inside your OpenLiteSpeed configuration since Certbot doesn’t include a native integration.
Test Certificate Renewal
$ sudo certbot renew --dry-run
Configure HTTPS in the Admin Console
Access your OpenLiteSpeed console again at http://SERVER-IP:7080 and navigate to Listeners. Click Add to create a new HTTPS listener with these values:
- Listener Name: HTTPS
- IP Address: ANY IPv4
- Port: 443
- Secure: Yes
Click Save, then open the new HTTPS listener via View. Under Virtual Host Mappings, click Add and enter:
- Virtual Host: app.example.com
- Domains: app.example.com
Apply SSL Certificate Details
Open the SSL tab and click Edit under the SSL Private Key & Certificate section. Provide the following paths:
- Private Key File: /etc/letsencrypt/live/app.example.com/privkey.pem
- Certificate File: /etc/letsencrypt/live/app.example.com/fullchain.pem
- Chained Certificate: Yes
Click Save, then perform a Graceful Restart to apply SSL settings.
Note: When hosting multiple virtual hosts, repeat this process for each and enable SSL individually through their configuration tabs.
Set Up Firewall Rules
UFW (Uncomplicated Firewall) is activated by default on Ubuntu servers. Configure it to permit connections to ports 7080, 443, and 80 as outlined below.
Enable UFW and Allow SSH Connections
If UFW is inactive, enable it and make sure that SSH access through port 22 is allowed to prevent losing remote connection.
$ sudo ufw allow 22/tcp && sudo ufw enable
Allow Access to the OpenLiteSpeed Console
Permit inbound connections on port 7080 to access the OpenLiteSpeed administration panel.
$ sudo ufw allow 7080/tcp
Allow HTTP Traffic
Enable incoming HTTP connections to the server so that it can serve web content on port 80.
$ sudo ufw allow http
Allow HTTPS Traffic
Allow secure HTTPS connections to your server on port 443.
$ sudo ufw allow https
Reload and Verify Firewall Rules
Restart UFW to apply all recent configuration changes.
$ sudo ufw reload
Check the firewall’s current status to ensure that the rules are properly active on your server.
$ sudo ufw status
Now, open a web browser and access your domain via HTTPS to confirm that your SSL configuration is functioning correctly.
https://app.example.com
Conclusion
In this tutorial, you installed and configured the OpenLiteSpeed web server on Ubuntu 22.04. You also created and secured a virtual host to serve web applications over HTTPS. OpenLiteSpeed includes built-in PHP support, making it a powerful choice for hosting dynamic web applications tailored to your development needs.


