How To Install the OpenLiteSpeed Web Server on Ubuntu 14.04
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:
- sudo apt-get update
- 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):
- cd ~
- 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:
- tar xzvf openlitespeed*
- 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:
Once our software is compiled, we can install it onto our system by typing:
- sudo make install
This will install the entire OpenLiteSpeed system under the
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:
- 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:
- sudo mysql_install_db
Next, we need to fix some insecure defaults by running a simple cleanup script. Type:
- 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:
- 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:
- 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:
You will see a page the default OpenLiteSpeed web page, that looks like this:
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:
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:
Once you correctly authenticate, you will be presented with the OpenLiteSpeed administration interface:
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”:
In the list of listeners, you can click the “View/Edit” button for the “Default” listener:
You can click the edit button in the top-right corner of the “Address Settings” table to modify its values:
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”:
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
- 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
- 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.
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.