How to Install the Openlitespeed Web Server, PHP and Mariadb on Centos
Edit Article

  • 1 Editor


OpenLiteSpeed is a web browser that has been optimized for better output and is open source so that more and more sites can be manages and served by it. When we’re talking about Linux based systems in particular, multiple compelling features of OpenLiteSpeed make it a very strong choice for many installations. Some of the features that it has include rewrite rules compatible with Apache, an interface for web administration and customized PHP processing that has been optimized for the server.

This guide that is made foe you will show you how to install and configure OpenLiteSpeed and its features and components on Centos 7 server. The essential components that we are going to use and need during our installation include MariaDB and PHP5.6. The use of MariaDB is required to achieve the conventional setup of a web server, processing of the script dynamically and management system for the database.


Before you go on to start our guide to installing OpenLiteSpeed, we need to have a non-root user account. This account should be configured on your server along with complete sudo privileges.

Along with installing OpenLiteSpeed on your server, we will also configure and install MariaDB so that we can communicate and interact with many common we services and applications. A customized version of PHP is used by OpenLiteSpeed that is also available to you from OpenLiteSpeed repos. Along with MariaDB we will also install a custom PHP package and the required PHP extension for OpenLiteSpeed.

Adding the OpenLiteSpeed Repository:

We can save the hassle of compiling the software ourselves. The easiest way to do so is using OpenLiteSpeed’s pre-maintained package repository for Centos 7. We can install OpenLiteSpeed and its associated packages from there.

This line of code will add the repository information to our system:

sudo rpm -ivh

This will update the whole list of repositories that yum references when it searches for and installs packages.

Installing the Components:

We now have access to the OpenLiteSpeed repository. All of the components that are needed can be installed. We will start with installing the web server itself along with MariaDB. MariaDB is the DBMS that we will be using:

sudo yum install openlitespeed mariadb-server

An already customized version of PHP is included with the installation. This version works well with the OpenLiteSpeed. But the version that is included in in the PHP 5.3 family. There are other versions of PHP included in the repositories that work with the web server.

For this purpose we will be installing PHP version 5.6 and the required PHP extension that is needed to connect to the MariaDB. The versions of these components will be starting with "ls". This line of code will be used to install PHP 5.6 and the database extension:

sudo yum install lsphp56 lsphp56-mysql

If you want to see all the available extensions for the 5.6 version of the OpenLiteSpeed build then you will use yum to search:

yum search lsphp56

Installing all the versions is not always a good idea but if you want to do so then type this line of code:

sudo yum install lsphp56-* --skip-broken

Now it’s time to do some configurations after we’re done with installing all of the components.

Changing the Default Password for OpenLiteSpeed:

The default password for OpenLiteSpeed needs to be changed. The default password for OpenLiteSpeed is set to ‘123456’

The script given below will be used to change the password:

sudo /usr/local/lsws/admin/misc/

There is an option in which you can select a username for the administrator account. If you press enter, the default username will be set which has the value of “admin”. After you’re done with this, you need to give a password and then verify by re-entering it. The password that you give should be a strong one because the administrative login screen is by default open to the web.

Linking the New PHP Version:

During the installation step we installed the version 5.6 of the customized PHP processor. We never told the web server that the version that we installed earlier is that version of PHP that we want to use for normal operations.

To enable the version 5.6 we link it into the location which is called on by OpenLiteSpeed when it attempts to execute the PHP code. The location of the file that is called on is at /usr/local/lsws/fcgi-bin/lsphp5. Right now that location is linked to lsphp in the same directory which by the way is the version of PHP installed as default by OpenLiteSpeed (5.3).

To change the linking, we use the following script:

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

Now the web server will use the 5.6 version of OpenLiteSpeed’s PHP when it processes PHP files.

Starting and Securing MariaDB System:

We need to start the MariaDB system. Some simple configurations must be done. You can start MariaDB by typing:

sudo systemctl start mariadb

We need to enable the service so that when our machine boots the service can start automatically. This can be done by:

sudo systemctl enable mariadb

Now that MariaDB is online, you need to run a security script that will lock down some insecure defaults and set an administrative password:

sudo mysql_secure_installation

You will need to enter the MariaDB root password first. Since we have not yet set a password, we’ll just press enter and continue. You will have to set a root password in the very next step. Just simply select and confirm a new administrative password for your database system.

The rest of the questions, you can just simple hit enter and accept the default suggestions. This will help and revert some insecure settings that were on your database system.

Testing the Default Page and Admin Interface:

The OpenLiteSpeed server should be functional now. To check the start, stop, restart, status of the server, you just need to use the standard service command with the 1sws service name:

sudo service lsws status

You can check out OpenLiteSpeed’s default web page in your web browser. Go to your server’s domain name or IP address followed by :8808 by which you will specify he port:


This page will be displayed in front of you:


Most of the links have already installed and configured features which respond correctly when clicked. As an example, CGI script is there, a customized PHP instance is functional, authentication gates and custom error pages are configured. You can explore a little by clicking around.

Once you are happy with the default site, we will move on to the administrative interface. Go to your web browser and then using HTTPS navigate to your server’s IP address followed by: 7080 to specify the port:


You will get a warning telling you that the certificate from the website cannot be authenticated. The certificate is self- signed so you should expect this warning. Click through whatever options you have to proceed ahead to the site.

The password that you selected with the, you will need to enter it here!!


Once you’re authenticated, you should see the administrative interface that should be like this:


This is the place where most configurations for the web server will be done.

Changing the Port for the Default Page:

Just so you have the basic idea behind configuring options through this web interface, I will change the port that out default site uses from “8088” to 80.

This can be done by using “Configuration” menu item which is located in the menu bar and then select “Listeners”.


When you go to the list of listeners you can click the ‘View/Edit” button for the “Default” listener.


There is an edit button at the top right corner. You can click that button to edit and modify the table’s values.


On the very next screen you should change the port “8088” to port “80” and then click “Save”.

After you have made this modification, you have to restart the server. This step can be performed through “Actions” menu. You will have to select “Graceful Restart” from there.


Now you should see the default web page in your web browser on port “80”. Now you can visit your website without giving your server’s domain name or IP address.

Article Tools

Did this article help you?


an Author!

Write an Article