Akhil Dev

Akhil Dev

How To Install the OpenLiteSpeed Web Server on Ubuntu 18.04

Introduction

How To Install the OpenLiteSpeed Web Server on Ubuntu 18.04?

OpenLiteSpeed is an optimized open source web server that can be use to manage and serve sites. OpenLiteSpeed has some useful features that make it a solid choice for many installations: it features Apache-compatible rewrite rules, a built-in web-based administration interface, and customized PHP processing optimized for the server.

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

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 tamper 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 install, we’ll secure it by updating the default admin account.

Setting the Administrative Password

Before we test the server, we should set a new administrative password for OpenLiteSpeed. By default, the password is set to 123456, so we should change this immediately. We can do this by running a script provided by OpenLiteSpeed:

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

You will 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 prompt to create and confirm a new password for the account. Do so, then hit ENTER one last time. The script will confirm a successful update:

Output
Administrator'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.

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
Output
litespeed 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:

screenshot of the default OpenLiteSpeed demo page- OpenLiteSpeed Web Server on Ubuntu 18.04

The links towards the bottom of the page are design to demonstrate various features of the server. If you click through them you will notice that these features are already installed and properly configured. For instance, an example CGI script is available, a customized PHP instance is up and running, custom error pages and authentication gates is configure. Click around to explore a little.

When you are satisfy 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

You will likely see a page warning you that the SSL certificate from the server cannot be validated. Since this is a self-signed certificate. Click through the available options to proceed to the site. 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:

screenshot of the OpenLiteSpeed admin login page- OpenLiteSpeed Web Server on Ubuntu 18.04

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

screenshot of the OpenLiteSpeed admin dashboard- OpenLiteSpeed Web Server on Ubuntu 18.04

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

Next, we’ll explore this interface by walking through a common configuration task: updating the port used by the default page.

Changing the Port for the Default Page

To demonstrate how to configure options through the web interface, we will change the port that the default site uses from 8088 to the conventional 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:

screenshot of OpenLiteSpeed's listeners summary page- OpenLiteSpeed Web Server on Ubuntu 18.04

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:

screenshot of OpenLiteSpeed's listener detail page- OpenLiteSpeed Web Server on Ubuntu 18.04

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

screenshot of OpenLiteSpeed's listener update interface- OpenLiteSpeed Web Server on Ubuntu 18.04

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

graceful restart button- OpenLiteSpeed Web Server on Ubuntu 18.04

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

OpenLiteSpeed is a fully-featured web server that is primarily manage through the administrative web interface. A full run through of how to configure your site through this interface is outside of the scope of this guide.

However, to get you start, we’ll touch on a few important points below:

  • 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. However, all of the directories that you will reference when setting up your configuration must be created ahead of time on your server. OpenLiteSpeed is not able to create the directories
  • You can set up virtual host templates for virtual hosts that share the same general format.
  • Often, it is easiest to copy the default virtual host’s directory structure and configuration to use as a starting point for new configurations.
  • The admin interface has a built-in tooltip help system for almost all fields. There is also a Help menu option in the left-hand menu that links to the server documentation. Consult these sources of information during configuration if you need more help.
  • To secure your OpenLiteSpeed installation with HTTPS, see the officall documentation’s section on SSL Setup

At this point, you should have OpenLiteSpeed and PHP installed and running on an Ubuntu 18.04 server. OpenLiteSpeed offers great performance, a web-based configuration interface, and pre-configured options for script handling.

Facebook
Twitter
LinkedIn
Reddit
Email

Leave a Comment

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