How To Install the OpenLiteSpeed Web Server on Ubuntu 18.04 / 20.04

In this tutorial, we have managed to share a brief guide to install OpenLiteSpeed Server on Ubuntu 18.04 and Ubuntu 20.04.

In this guide, we’ll demonstrate how to install and configure OpenLiteSpeed on an Ubuntu 18.04 server.

Also read: How to Install Postman on Ubuntu 18.04 / 20.04

Prerequisites

To complete this tutorial you will need an Ubuntu 18.04 server with a sudo-enabled, non-root user and the ufw firewall enabled.

Please refer to our Initial Server Setup with Ubuntu 18.04 tutorial for instructions on fulfilling these requirements.

#Step 1 – Installing OpenLiteSpeed

OpenLiteSpeed provides a software repository we can use to download and install the server with Ubuntu’s standard apt command.

To enable this repository for your Ubuntu system, first download and add the developer’s software signing key:

wget -qO - https://rpms.litespeedtech.com/debian/lst_repo.gpg | sudo apt-key add -

This key is used to cryptographically verify that nobody has tampered with the software we’re about to download.

Next, we add the repository information to our system:

sudo add-apt-repository 'deb http://rpms.litespeedtech.com/debian/ bionic main'

After the repository has been added, the add-apt-repository command will refresh our package cache and the new software will be available to install.

Install the OpenLiteSpeed server and its PHP processor using apt install:

sudo apt install openlitespeed lsphp73

Finally, create a soft link to the PHP processor we just installed. This directs the OpenLiteSpeed server to use the correct version:

sudo ln -sf /usr/local/lsws/lsphp73/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5

Now that the OpenLiteSpeed server is installed, we’ll secure it by updating the default admin account.

#Step 2 – Change Default Administrative Password

Before we test the web server, we should set a new administrative password for OpenLiteSpeed admin. The default password is 123456, so we should change this immediately. To change the password run the script below.

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

Next, you’ll be asked to provide a username for the administrative user. If you press ENTER without choosing a new username, the default of admin will be used. Then, you will be prompted to create and confirm a new password for the account. Do so, then hit ENTER again. The script will confirm a successful message like below:

OutputAdministrator's username/password is updated successfully!

Now that we’ve secured the admin account, let’s test out the server and make sure it’s running properly.

#Step 3 – Starting and Connecting to the Server

OpenLiteSpeed should have started automatically after it was installed. We can verify this using the lswsctrl command:

sudo /usr/local/lsws/bin/lswsctrl status

If you see a message shown below, litespeed is running successfully

Outputlitespeed is running with PID 990.

If you don’t see a similar message, you can start the server using lswsctrl:

sudo /usr/local/lsws/bin/lswsctrl start
Output[OK] litespeed: pid=5137.

The server should now be running. Before we can visit it in our browser, we need to open up some ports on our firewall. We’ll do this with the ufw command:

sudo ufw allow 8088
sudo ufw allow 7080

The first port, 8088, is the default port for OpenLiteSpeed’s example site. It should now be accessible to the public. In your web browser, navigate to your server’s domain name or IP address, followed by :8088 to specify the port:

http://server_domain_or_IP:8088

Your browser should load the default OpenLiteSpeed web page, which looks like this:

openlitespeed welcome page

When you are satisfied with the default site, you can move on to the administrative interface. In your web browser, using HTTPS, navigate to your server’s domain name or IP address followed by :7080 to specify the port:

https://server_domain_or_IP:7080

The browser may return a page warning about the SSL certificate from the server. Since this is a self-signed certificate, this is expected. Proceed to continue. In Chrome, you must click “Advanced” and then “Proceed to”.

You will be prompted to enter the administrative username and password that you selected with the admpass.sh script in the previous step:

openlitespeed admin login

Once you correctly authenticate, you will be presented with the OpenLiteSpeed administration interface:

openlitespeed admin dashboard

This is where the majority of your configuration for the web server will take place.

Next, we will update the port used by the default page.

#Step 4 – Changing the Port for the Default Page

To show how to configure options through the web interface, we will change the port that the default site uses from 8088 to the standard HTTP port 80.

To accomplish this, first click Listeners in the list of options on the left side of the interface. A list of all available listeners will load.

In the list of listeners, click the “View/Edit” button for the Default listener:

openlitespeed listeners summary

This will load a page with more details about the Default listener. Click the edit button in the top-right corner of the “Address Settings” table to modify its values:

openlitespeed listener details

On the next screen, change port 8088 to port 80, then click the save icon, Save:

openlitespeed listener update

After the modification, you will need to restart the server. Click the “reload” arrow icon to restart OpenLiteSpeed:

openlitespeed graceful restart

Additionally, you’ll need to now open up port 80 on your firewall:

sudo ufw allow 80

The default web page should now be accessible in your browser on port 80 instead of port 8088. Visiting your server’s domain name or IP address without providing any port number will now display the site.

Conclusion

Unlike Apache or nginx, OpenLiteSpeed is a fully-featured web server that is primarily managed through the administrative web interface. There are many options available for configure and its impossible to mention everything here.

However, we will discuss some points below.

  • lsws is its root directory, everything associated with OpenLiteSpeed will be found under the /usr/local/lsws directory.
  • The document root (where your files will be served from) for the default virtual host is located at /usr/local/lsws/DEFAULT/html. The configuration and logs for this virtual host can be found under the /usr/local/lsws/DEFAULT directory.
  • You can create new virtual hosts for different sites using the admin interface.
  • You can set up virtual host templates for virtual hosts that share the same general format.
  • To secure your OpenLiteSpeed installation with HTTPS, see the official documentation’s section on SSL Setup

This article can help you with installing OpenLiteSpeed and PHP on an Ubuntu 18.04 / 20.04 server. OpenLiteSpeed with latest technology configuration offers great performance, a web-based configuration interface, and pre-configured options for script handling mainly for WordPress powered websites.

Looking to install WP on LiteSpeed. Follow our tutorial on How to Install WordPress on OpenLiteSpeed Server.

There is also a plugin LScache exclusively for WordPress websites to improve page loading and cache.

Follow TechBiriyani on FacebookTwitter to get all the latest updates.

Leave a Comment