Skip to content
Follow
Ubuntu Linux

How to Install OpenLiteSpeed on Ubuntu Linux

Richard
Written by
Richard
Updated 9 min read
How to Install VMware Workstation Player on Ubuntu Linux
How to Install VMware Workstation Player on Ubuntu Linux

OpenLiteSpeed is a free, high-speed web server for Ubuntu Linux. It handles high traffic faster than Apache. It also includes a built-in web admin panel, so you can manage most server settings from a browser instead of editing files by hand.

Advertisement

Installing OpenLiteSpeed on Ubuntu takes only a few terminal commands. This guide also covers PHP and MariaDB, a database system that stores your site data, so the server can run platforms like WordPress. You need an Ubuntu server, a user with administrator (sudo) rights, and a working internet connection. Run every command in the terminal, either at the server console or over SSH.

⚡ Quick Answer

Run these commands in the Ubuntu terminal: first add the OpenLiteSpeed repository with wget -O – http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash, then run sudo apt update followed by sudo apt install openlitespeed. The service starts automatically after installation. To serve sites on port 80, change the port in /usr/local/lsws/conf/httpd_config.conf.

Advertisement

How to install OpenLiteSpeed on Ubuntu from the repository

The best way to install OpenLiteSpeed on Ubuntu is from the official repository. A repository is an online software source that Ubuntu checks for updates. Once you add it, OpenLiteSpeed updates along with your other packages, so you get the latest patches without downloading anything by hand.

Setting this up takes two stages: add the repository, then install the package. Both are done in the terminal.

First, add the repository. Run the commands below in your terminal, in the order shown:

💻Code
wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash

The commands above also import the OpenLiteSpeed GPG key into Ubuntu and activate it. Ubuntu uses this key to check that packages really come from the OpenLiteSpeed project and were not altered on the way.

Advertisement

Once the repository is added, run the commands below to install OpenLiteSpeed. The download may take a minute, depending on your connection.

🐧Bash / Shell
sudo apt update
sudo apt install openlitespeed

After the installation finishes, use the commands below to start and stop the OpenLiteSpeed service and to enable it. Enabling the service makes it start by itself whenever the server boots, so your sites come back after a reboot without any action from you.

🐧Bash / Shell
sudo systemctl stop lshttpd
sudo systemctl start lshttpd
sudo systemctl enable lshttpd

Next, check that the OpenLiteSpeed service is running. Run the commands below:

🐧Bash / Shell
sudo systemctl status lshttpd

The output should look similar to the lines below. Look for a status that says the service is active (running). If it says failed or inactive, start the service again with the commands above before you continue.

🐘PHP
lshttpd.service - OpenLiteSpeed HTTP Server
     Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-09-11 17:43:24 CDT; 13s ago
   Main PID: 5773 (litespeed)
     CGroup: /system.slice/lshttpd.service
             ├─5773 openlitespeed (lshttpd - main)
             ├─5783 openlitespeed (lscgid)
             ├─5813 openlitespeed (lshttpd - #01)
             └─5814 lsphp

Sep 11 17:43:22 ubuntu2004 systemd[1]: Starting OpenLiteSpeed HTTP Server.
Sep 11 17:43:22 ubuntu2004 lswsctrl[5745]: [OK] litespeed: pid=5773.

How to configure OpenLiteSpeed on Ubuntu Linux

📝Good to KnowBy default, OpenLiteSpeed serves websites on port 8088.

You can change this to the standard web port 80, so visitors do not have to type a port number in the browser. The change is made in the main configuration file, which you edit in the terminal. If this server already runs another web server, such as Apache or Nginx, stop it first or it will hold port 80 and OpenLiteSpeed will not start on it.

Advertisement

To begin, run the commands below to open the configuration file in a text editor:

🐧Bash / Shell
sudo nano /usr/local/lsws/conf/httpd_config.conf

Now change the port:

  1. Look for the lines shown below in the file.
  2. Change the highlighted port from 8088 to 80.

Change only the port number and leave the rest of each line as it is.

💻Code
listener Default{
    address                  *:80
    secure                   0
    map                      Example *
}

Save your changes and exit the editor.

The new port only takes effect after a restart. Restart OpenLiteSpeed by running the commands below:

🐧Bash / Shell
sudo systemctl restart lshttpd

Now test it. Open your browser and go to the server hostname or IP address. You should see the OpenLiteSpeed default welcome page. If the page does not load, check that the service is running and that your firewall, such as UFW or your cloud provider’s security group, allows traffic on port 80.

Advertisement
💻Code
http://localhost
OpenLiteSpeed default web server homepage on Ubuntu
openlitespeed default web server home

With the port changed to 80, set up the administrator password. You will use it to log on to the OpenLiteSpeed admin panel. Run the commands below:

🐧Bash / Shell
sudo /usr/local/lsws/admin/misc/admpass.sh

The command prompts you for an admin username and a new password:

  1. Type a username at the prompt, or leave it blank to use the default, admin.
  2. Enter a password, then type it again to confirm it.

Pick a strong password. The admin panel controls the whole server, so treat it like a root login.

💻Code
Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: 

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password: 
Retype password: 
Administrator's username/password is updated successfully!

The admin panel runs on its own port, separate from your websites. You can reach it with the link below. If the page does not open from another computer, check that your firewall allows that port.

🐘PHP
https://localhost:7080/login.php

Log in with the admin username and password you just created. Your browser may warn about the connection being unsafe, because the panel uses a self-signed certificate by default. That is expected for a fresh install.

Advertisement
OpenLiteSpeed admin panel interface for server management
openlitespeed admin panel

How to install PHP 8.0 support for OpenLiteSpeed

PHP lets OpenLiteSpeed run dynamic pages such as WordPress. This section installs PHP 8.0 and connects it to the web server. A few terminal commands add the PHP packages, and then you point OpenLiteSpeed at them in the admin panel.

PHP 8.0 gives better performance than earlier versions, and this guide was written around it. Note that PHP 8.0 no longer receives security updates from the PHP project. For a new production site, check whether the repository offers a newer PHP version and use that instead. The steps in the admin panel are the same for any version.

To install PHP 8.0 on Ubuntu Linux, run the commands below in your terminal:

🐧Bash / Shell
sudo apt install lsphp80 lsphp80-mysql lsphp80-common lsphp80-opcache lsphp80-curl

Now tell OpenLiteSpeed to use PHP 8.0 by adding it as an external app:

  1. Log on to the admin panel.
  2. Go to Server Configuration External App.
  3. Click the + button to add a new external app.

A window opens and asks what type of app you want to add.

Advertisement
Updating PHP settings in OpenLiteSpeed on Ubuntu
openlitespeed php update
  1. Choose LiteSpeed SAPI App as the type of app.
  2. Click Next (the arrow).

The form for the PHP settings opens.

Configuring external application types in OpenLiteSpeed
openlitespeed type of external app

On the PHP configuration settings, enter the recommended values shown below. If you use a different PHP version, adjust the version-specific values to match it.

🐘PHP
Name: lsphp8.0
Address: uds://tmp/lshttpd/lsphp80.sock
Max Connections: 10
Environment: PHP_LSAPI_CHILDREN=10
LSAPI_AVOID_FORK=200M
Initial Request Timeout (secs): 60
Retry Timeout (secs): 0
Persistent Connection: Yes
Response Buffering: No
Command: lsphp80/bin/lsphp
Backlog: 100
Instances: 1
Priority: 0
Memory Soft Limit (bytes): 2047M
Memory Hard Limit (bytes): 2047M
Process Soft Limit: 1400
Process Hard Limit: 1500
PHP configuration settings in OpenLiteSpeed server
openlitespeed php configuration

Save your changes. The new app should now appear in the External App list.

Advertisement

The Script Handler decides which program runs each type of website code. A handler for the php file type must point at the PHP app you just created. To change the rules:

  1. Open the admin panel menu and go to Server Configuration Script Handler.
  2. Click Edit on the existing handler.

Editing these rules controls how website code runs. For example, you could point a handler at PHP 8.1 for better performance. In this guide, we point it at the PHP 8.0 app created above.

Updating script handler settings in OpenLiteSpeed
openlitespeed script handler update

In the handler settings, choose the new PHP 8.0 handler you created above, then save. If you do not see it in the list, go back and confirm the external app was saved.

Changing PHP handler settings in OpenLiteSpeed
openlitespeed php handler change

To test the change:

  1. Restart the server, using the same restart commands you ran earlier.
  2. In your browser, go to the server name or IP address followed by /phpinfo.php.

You should see the PHP information page with the PHP version near the top.

🐘PHP
http://localhost/phpinfo.php
⚠️WarningIf the page shows PHP 8.0, it is now the default handler.

When you finish testing, don't leave a phpinfo page reachable on a public server, because it lists details about your setup that attackers can use.

OpenLiteSpeed PHP 8 default configuration on Ubuntu
openlitespeed php 8 default

How to install MariaDB on Ubuntu Linux

Most PHP applications, WordPress included, need a database. MariaDB is a popular open-source database server that works as a drop-in replacement for MySQL. You install it with Ubuntu's package manager, which sets up both the server and the client tools. Then you make sure the service starts automatically at boot.

Run the commands below to install MariaDB:

🐧Bash / Shell
sudo apt install mariadb-server
sudo apt install mariadb-client

After the installation, use the commands below to stop, start and enable the MariaDB service. Enabling it makes the database start by itself when the server boots.

🐧Bash / Shell
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Next, secure the database server and set a root password. Run the commands below. If the installer already asked you to do this, you can still run them again to review the settings.

🐧Bash / Shell
sudo mysql_secure_installation

The script asks a series of yes or no questions. When prompted, use the guide below to answer. Each answer removes a default setting that is fine for testing but unsafe on a live server, such as anonymous users or a test database.

💻Code
If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): PRESS ENTER

Switch to unix_socket authentication [Y/n] n

Change the root password? [Y/n] n

Remove anonymous users? [Y/n] y

Disallow root login remotely? [Y/n] y

Remove test database and access to it? [Y/n] y

Reload privilege tables now? [Y/n] y

All done!

To confirm that MariaDB is installed and working, log in to the database console with the commands below:

🐧Bash / Shell
sudo mysql -u root -p

You should be logged in automatically, because the login request runs as root. Only root can log in without a password, and only from the server console. Remote or non-root users still need a password.

mariadb welcome
mariadb ubuntu 1604

If you see a screen similar to the one below, the database server was installed successfully. Type the exit command to leave the console.

That should do it!

Conclusion:

This guide showed how to install OpenLiteSpeed on Ubuntu from the official repository, move it to port 80, and set up the admin panel. It also covered adding PHP 8.0 and installing MariaDB. Your server is now ready for a site such as WordPress. You can use the comment form below to report errors or add information about the OpenLiteSpeed installation.

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

3 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *