How To Install Openlitespeed, PHP & MariaDB on CentOS

There are many useful tools for Linux distros which allow us to expand much more included features.

One of these free tools is OpenLiteSpeed, and today this tutorial will analyze in detail how to install and use this valuable tool in CentOS

What is OpenLiteSpeed?

OpenLiteSpeed is an open source HTTP server developed by LiteSpeed Technologies which has features that allow the an easy administration of hundreds or thousands of connections simultaneously without overloading the CentOS 7 server.

With this in mind, we will begin the installation process of OpenLiteSpeed in CentOS 7.

Enable OpenLiteSpeed Repositories

The first step is to download and install the official OpenLiteSpeed repositories for later installation.

For this we will execute the following line:

rpm -ivh
Note: This must be run as the root user.

Install OpenLiteSpeed in CentOS 7

Once we have the repository enabled we proceed to the installation of OpenLiteSpeed which will be installed by default in the path /usr/local/lsws, and we will do it by executing the following line:

yum install openlitespeed

Once OpenLiteSpeed has been installed, we proceed to execute and verify the server version by executing the following lines:

/usr/local/lsws/bin/lswsctrl start

/usr/local/lsws/bin/lshttpd -v

Configure OpenLiteSpeed Ports

By default, the server will use port 8088, so it is necessary to update the rules and grant the necessary permissions, for which we will execute the following:

firewall-cmd --zone=public --permanent --add-port=8088/tcp

firewall-cmd –reload

Run OpenLiteSpeed in CentOS 7

Once the port is enabled, we access a browser and enter any of the following syntaxes in the address bar:



Install PHP 7 for OpenLiteSpeed

The next step is to install PHP for the optimal functioning of OpenLiteSpeed in CentOS 7 and this, it will be necessary to perform the following steps:

First, we will enable the EPEL repositories by executing the following line. We accept the download.

yum install epel-release

Now we will install PHP 7 with some modules which will be installed in the path usr/local/lsws/lsphp70/bin/lsphp; we will execute the following line:

yum install lsphp70 lsphp70-common lsphp70-mysqlnd lsphp70-process lsphp70-gd lsphp70-mbstring lsphp70-mcrypt lsphp70-opcache lsphp70-bcmath lsphp70-pdo lsphp70-xml

Configure OpenLiteSpeed & PHP 7

OpenLiteSpeed has a WebAdmin console that is associated with port 7080 by default, and the first step will be to configure the user and password for that console. We achieve this by executing the following command:


In the displayed window we will enter the user's name and the corresponding password:

Now we will update the rules of the firewall to allow access through port 7080 for it we will execute the following lines:

firewall-cmd --zone=public --permanent --add-port=7080/tcp

firewall-cmd --reload

Now we go to the browser, and we can access the OpenLiteSpeed console using any of the following options:



A message about insecure connection prompt us, you need to make an exception for that address.

There we will access the console where we will enter the credentials of the user that we have created previously:

Click on Login, and this will be the OpenLiteSpeed environment. OpenLiteSpeed uses LSPHP 5 by default, and it will be necessary to configure them to use PHP 7 which was previously installed.

For this we go to the Server Configuration section located on the left side and go to the External App tab and click on the right icon to select the Add option:

In the displayed line, select the LiteSpeed SAPI App option and click on the Next button:

There we will configure the following values:

  • Name: lsphp70
  • Address: uds: //tmp/lshttpd/lsphp.sock
  • Notes: LSPHP70 Configuration
  • Max Connections: 35
  • Initial Request Timeout (secs): 60
  • Retry Timeout: 0
  • Command: /usr/local/lsws/lsphp70/bin/lsphp

Click on the Save button to apply the changes. We'll see that PHP 7 has been added to the OpenLiteSpeed configuration:

Now we go to the Script Handler tab and click on the Edit button to edit lsphp5, and there we will assign the following values:

  • Suffixes: php
  • Handler Type: LiteSpeed SAPI
  • Handler Name: lsphp70
  • Notes: lsphp70 script handler definition

Now we must change the listening port of OpenLiteSpeed to port 80 which is the predefined one of the HTTP servers, and OpenLiteSpeed brings port 8080 pro defect. For this change, go to the Listeners section and click on the View icon:

In the window displayed click on Edit and set the port to 80. Click on Save to save the changes.

Now we must restart the server to apply all the changes, and for this, we click on the Graceful Restart button located at the top:

Click on the Go button to restart

Verify OpenLiteSpeed & PHP 7 in CentOS 7

Once adjusted the listening ports we must allow port 80 in CentOS 7, and for this, we execute the following lines:

firewall-cmd --zone=public --permanent --add-port=80/tcp

firewall-cmd –reload

Now we can check connectivity using the following lines in the browser's address bar:



Install MariaDB for OpenLiteSpeed

Finally, we can install the MariaDB database manager for OpenLiteSpeed by executing the following line:

yum install openlitespeed mariadb-server

Later we will start MariaDB and execute the secure installation with these lines:

systemctl start mariadb


We have seen how we have OpenLiteSpeed to have availability of a powerful HTTP server free and with extensive use options.

Similar Posts

Leave a Reply

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