Tutorial

How To Install the OpenLiteSpeed Web Server on Ubuntu 14.04

How To Install the OpenLiteSpeed Web Server on Ubuntu 14.04
Not using Ubuntu 14.04?Choose a different version or distribution.
Ubuntu 14.04

Introduction

OpenLiteSpeed is an optimized open source web server that can be used to manage and serve sites. As far as Linux web servers are concerned, OpenLiteSpeed has some interesting features that make it a solid choice for many installations. It features Apache compatible rewrite rules, a web 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 14.04 server. We will also download and install MySQL to complete the conventional setup of a web server, dynamic script processor, and database management system.

Prerequisites and Goals

Before we begin, you should have a non-root user account configured on your server, complete with sudo privileges. To learn how to set up an account like this, follow our Ubuntu 14.04 initial server setup guide.

This tutorial will guide you through the process of compiling, installing, and configuring an OpenLiteSpeed instance on your server. We will also install and configure MySQL to facilitate interaction with many common web applications and services. OpenLiteSpeed comes with PHP embedded into the actual server, but we will show you where to go to customize this if you have specific needs.

Install Dependencies and Build Dependencies

We will be installing OpenLiteSpeed from source since the project does not provide any pre-built binaries for Ubuntu. Before we can begin the installation process however, we need to take care of some dependencies.

Fortunately, all of the dependencies that we need can be found in Ubuntu’s default repositories. We can update the local package index file and then install all of the components that we need. These will be pieces that are needed to compile the software, as well as the supporting components that OpenLiteSpeed will use to implement certain functionality:

  1. sudo apt-get update
  2. sudo apt-get install build-essential libexpat1-dev libgeoip-dev libpng-dev libpcre3-dev libssl-dev libxml2-dev rcs zlib1g-dev

At this point, we have everything we need to compile and install OpenLiteSpeed.

Compile and Install OpenLiteSpeed

Next, we need to download the current latest version of the OpenLiteSpeed software. You can find the source files on the OpenLiteSpeed download page.

We want to install the latest current stable version of the software. At the time of this writing, that would be version 1.3.10, but it will likely be different for you. Right-click on the link for the latest stable version in your browser and select “Copy link address” or whatever similar option your browser provides.

Back in your terminal, move into your home directory. Type in the wget command and then paste in the link that you copied from the website (again, your link will likely be different):

  1. cd ~
  2. wget http://open.litespeedtech.com/packages/openlitespeed-1.3.10.tgz

Once the archive has been downloaded, extract it and then move into the resulting project directory by typing:

  1. tar xzvf openlitespeed*
  2. cd openlitespeed*

Next, we need to configure the software so that it can be properly build for our system. After the configuration has completed, we can compile the software to build our binaries:

  1. ./configure
  2. make

Once our software is compiled, we can install it onto our system by typing:

  1. sudo make install

This will install the entire OpenLiteSpeed system under the /usr/local/lsws location.

Install and Configure MySQL

Before we move any further, we will install the MySQL database management system so that our applications have a place to store persistent data.

We can install MySQL from Ubuntu’s repositories by typing:

  1. sudo apt-get install mysql-server

You will be asked to select and confirm an administrative password for the database system during the installation procedure.

Once the installation is complete, you can initialize the MySQL directory structure by typing:

  1. sudo mysql_install_db

Next, we need to fix some insecure defaults by running a simple cleanup script. Type:

  1. sudo mysql_secure_installation

You will be asked to provide the MySQL administrative password that you selected during installation. Afterwards, you will be asked if you want to select a different password. You can choose “N” for “no” here if you are content with your password choice. For the remaining questions, hit ENTER to accept the default suggestions.

Set the Administrative Password and Start OpenLiteSpeed

With OpenLiteSpeed and MySQL installed, we are now almost ready to start the web server.

Before we begin, we should set an administrative password for OpenLiteSpeed. By default, the password is set to “123456”, so we should change this before ever starting the server. We can do that by running an administrative script. Type:

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

You will be asked to optionally provide a username for the administrative user. If you just press ENTER, the username “admin” will be selected. Afterwards, you will be asked to select and confirm a new password for the account.

Once the password has been changed, start the web server by typing:

  1. sudo service lsws start

In your web browser, you can now access the default web page. Navigate to your server’s domain name or IP address, followed by :8088 to specify the port:

http://server_domain_or_IP:8088

You will see a page the default OpenLiteSpeed web page, that looks like this:

Default OpenLiteSpeed landing page

If you click through the links, you should notice that many features are already installed and configured correctly. For instance, an example CGI script is available, a customized PHP instance is up and running, custom error pages and authentication gates are configured. Click around to explore a little.

When you are satisfied with the default site, we 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 your that the SSL certificate from the server cannot be validated. Since this is a self-signed certificate, this is expected. Click through the options available to proceed to the site (in Chrome, you must click “Advanced” and then “Proceed to…”).

You will be prompted to enter the administrative name and password that you selected with the admpass.sh script a moment ago:

OpenLiteSpeed admin login

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

OpenLiteSpeed admin page

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

Change the Port for the Default Page

To demonstrate the basic idea behind configuring options through the web interface, we will change the port that the default site is using from “8088” to the conventional port 80.

To accomplish this, you can use the “Configuration” menu item in the menu bar and select “Listeners”:

OpenLiteSpeed listeners configuration

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

OpenLiteSpeed list of listeners

You can click the edit button in the top-right corner of the “Address Settings” table to modify its values:

OpenLiteSpeed change listener

On the next screen, change port “8088” to port “80” and click “Save”.

After the modification, you will need to restart the server, which can be accomplished through the “Actions” menu by selecting “Graceful Restart”:

OpenLiteSpeed graceful restart

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 a port will now display the site.

Information about Configuring OpenLiteSpeed

OpenLiteSpeed is a fully-featured web server that is primarily managed 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 started, 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 will not create the directories by itself.
  • 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 jumping off point for new configurations.
  • The admin interface has a built-in tool tip help system for almost all fields. There is also a “Help” menu option in the menu bar that links to the server documentation. Consult these sources of information during configuration if you need more information.
  • After modifying the configuration and doing a graceful restart, always click the “Home” button to see if any error messages were reported at the bottom of the status screen. You can see the full error logs by clicking “Actions > Server Log Viewer”.
  • PHP is included with OpenLiteSpeed by default, but may not be the correct version for your application. Because OpenLiteSpeed uses a specially optimized PHP instance, if you need a different version, you’ll have to compile it using the admin interface. You can get started by going to “Actions > Compile PHP” to select options. The interface will walk you through the process.

Conclusion

At this point, you should have OpenLiteSpeed (with PHP included) and MySQL installed and running on an Ubuntu 14.04 server. OpenLiteSpeed offers great performance, an easy-to-use interface, and pre-configured options for script handling. Dive in and learn the ropes to start leveraging these capabilities to serve your sites.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
1 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I dont like OLS, but when I configured it ~1 year ago - there were almost no tutorials in the Web. Thx for this. You may also need add here some words about PHP (hot to rebuld the version and include it on the website) - it is very useful if we say about OLS as alternative to LAMP or LNMP.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more