OpenLiteSpeed is a high-performance, scalable, open-source Web Server developed by  Litespeed technologies. It is apache drop-in replacement as it can be replaced apache web server without any major change. OpenLiteSpeed contains all the essential features right out of the box from LiteSpeed web server. In WordPress, OpenLiteSpeed along with LSCache plugin is the best choice as it helps to reduce the server’s response time. Below we see the benchmark result from LIteSpeed blog where it shows how OpenLiteSpeed handles 10,000 requests over 100 concurrent users. The larger the number, the better.

<img class="alignnone wp-image-48 size-full" src="/uploads/2019/04/wordpress-lscache.png" alt="" width="700" height="350" />

(Source: https://blog.litespeedtech.com/2018/03/05/compare-openlitespeed-to-nginx-and-apache/)

In this tutorial we will install OpenLiteSpeed Web Server, PHP 7.3 & MySQL. Also we tune the PHP configuration so that it performs better. Don’t worry. I developed a script that automate all the processes for us. This script currently works on fresh installed Debian 8/9 and CentOS 7 system.

Let’s begin

Install OpenLiteSpeed, PHP 7.3 with dependencies & MySQL

  1. First login to your server via ssh.

  2. Now get the root access

sudo su
  1. Download the OpenLiteSpeed installer script from the github repository
wget https://raw.githubusercontent.com/k4mrul/openlitespeed-installer-debian-centos/master/openlitespeed-installer.sh --no-check-certificate
  1. Setting the require permission
chmod +x openlitespeed-installer.sh
  1. Executing the script
./openlitespeed-installer.sh

Now the script will update the system and install the packages. After installing the mariadb, the script will prompt you to enter a default root password. By default there is no password is set. So simply press enter to enter into mariadb server and set/change new password by pressing ‘y’.

root@kamrul:~# ./openlitespeed-installer.sh
==================Updating system===========================

==================Installing openlitespeed with PHP 7.3===========================

==================Allowing firewall===========================

==================Tweaking PHP===========================

==================Install MariaDB 10.3===========================

Set mysql root password......

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n]

y

New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]

y

... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]

y

... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]

y

- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]

y

... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

And you have just install the openlitespeed web server.

=================&gt;Openlitespeed has been successfully installed&lt;==========================

Open web browser and browse http://SERVER_IP:7080/ and enter admin:123456 as login (don't forget to change the credentials from 'Webadmin Settings').\n

Thank you for using this script :)

Installation is success. Open web browser and browse http://SERVER_IP:7080/ to enter the web admin panel. The script should automatically get the server IP for you.

Changing default Web admin panel password

  1. When you will visit the web admin panel for the first time, you will see a warning. That’s normal as there is no valid SSL certificate is configured. Click “Advanced” and click “Proceed”.

<img class="alignnone wp-image-55 size-full" src="/uploads/2019/04/ssl_warning.png" alt="" width="833" height="616" srcset="/uploads/2019/04/ssl_warning.png 833w, /uploads/2019/04/ssl_warning-768x568.png 768w" sizes="(max-width: 833px) 100vw, 833px" />

  1. Login as admin & 123456 & you will see the OpenLiteSpeed control panel

<img class="alignnone wp-image-56 size-full" src="/uploads/2019/04/ols_control_panel.png" alt="" width="1907" height="848" srcset="/uploads/2019/04/ols_control_panel.png 1907w, /uploads/2019/04/ols_control_panel-768x342.png 768w" sizes="(max-width: 1907px) 100vw, 1907px" />

  1. To change the default credentials, click “WebAdmin Settings” from left panel and navigate to “Users” tab. Now click the edit icon.

<img class="alignnone wp-image-57 size-full" src="/uploads/2019/04/passwd_change.png" alt="" width="1651" height="621" srcset="/uploads/2019/04/passwd_change.png 1651w, /uploads/2019/04/passwd_change-768x289.png 768w" sizes="(max-width: 1651px) 100vw, 1651px" />

  1. Now simply change your username and password. When done, click the save icon

<img class="alignnone wp-image-58 size-full" src="/uploads/2019/04/passwd_change_done.png" alt="" width="1651" height="629" srcset="/uploads/2019/04/passwd_change_done.png 1651w, /uploads/2019/04/passwd_change_done-768x293.png 768w" sizes="(max-width: 1651px) 100vw, 1651px" />

Changing PHP version

Now we need to set the correct PHP version. By default OpenLiteSpeed uses PHP version 5. We need to make a few changes so that web server can use PHP version 7.3.

  1. Go to “Server Configuration” > “External App” tab and click “Add” icon
    <img class="alignnone wp-image-59 size-full" src="/uploads/2019/04/set_php_ver.png" alt="" width="1523" height="344" srcset="/uploads/2019/04/set_php_ver.png 1523w, /uploads/2019/04/set_php_ver-768x173.png 768w" sizes="(max-width: 1523px) 100vw, 1523px" />

  2. Select “LiteSpeed SAPI App” and click “Next”
    <img class="alignnone wp-image-60 size-full" src="/uploads/2019/04/set_php_ver2.png" alt="" width="1524" height="474" srcset="/uploads/2019/04/set_php_ver2.png 1524w, /uploads/2019/04/set_php_ver2-768x239.png 768w" sizes="(max-width: 1524px) 100vw, 1524px" />

  3. Now set the values like below:

Name: lsphp73
Address: uds://tmp/lshttpd/lsphp.sock
Notes: LSPHP73 Configuration
Max Connections: 35
Initial Request Timeout (secs): 60
Retry Timeout (secs): 0
Command: /usr/local/lsws/lsphp73/bin/lsphp
  1. Save the settings

<img class="alignnone wp-image-61 size-full" src="/uploads/2019/04/php_ver_set_done.png" alt="" width="1668" height="832" srcset="/uploads/2019/04/php_ver_set_done.png 1668w, /uploads/2019/04/php_ver_set_done-768x383.png 768w" sizes="(max-width: 1668px) 100vw, 1668px" />

  1. Next, click “Server Configuration” > “Script Handler” tab

<img class="alignnone wp-image-62 size-full" src="/uploads/2019/04/php_script_set.png" alt="" width="1523" height="597" srcset="/uploads/2019/04/php_script_set.png 1523w, /uploads/2019/04/php_script_set-768x301.png 768w" sizes="(max-width: 1523px) 100vw, 1523px" />

  1. Set required settings and click the save icon
Suffixes: php
Handler Type: LiteSpeed SAPI
Handler Name: lsphp73

<img class="alignnone wp-image-63 size-full" src="/uploads/2019/04/php_script_set_done.png" alt="" width="1514" height="646" srcset="/uploads/2019/04/php_script_set_done.png 1514w, /uploads/2019/04/php_script_set_done-768x328.png 768w" sizes="(max-width: 1514px) 100vw, 1514px" />

Changing OpenLiteSpeed default web server port

OpenLiteSpeed uses port 8088 for web server. However, HTTP normally listens to port 80. Let’s change the port.

  1. Go to “Listeners” option from left panel and click “View” icon on the default listener
    <img class="alignnone wp-image-64 size-full" src="/uploads/2019/04/set_listener.png" alt="" width="1526" height="462" srcset="/uploads/2019/04/set_listener.png 1526w, /uploads/2019/04/set_listener-768x233.png 768w" sizes="(max-width: 1526px) 100vw, 1526px" />

  2. In the “Address Settings”, click edit icon and change the port from 8088 to 80. Save the change
    <img class="alignnone wp-image-65 size-full" src="/uploads/2019/04/change_port.png" alt="" width="1509" height="363" srcset="/uploads/2019/04/change_port.png 1509w, /uploads/2019/04/change_port-768x185.png 768w" sizes="(max-width: 1509px) 100vw, 1509px" />
    <img class="alignnone wp-image-66 size-full" src="/uploads/2019/04/change_port2.png" alt="" width="1523" height="638" srcset="/uploads/2019/04/change_port2.png 1523w, /uploads/2019/04/change_port2-768x322.png 768w" sizes="(max-width: 1523px) 100vw, 1523px" />

  3. Finally click the “Reload” to apply all the changes

<img class="alignnone wp-image-67 size-full" src="/uploads/2019/04/reboot_ols.png" alt="" width="1655" height="645" srcset="/uploads/2019/04/reboot_ols.png 1655w, /uploads/2019/04/reboot_ols-768x299.png 768w" sizes="(max-width: 1655px) 100vw, 1655px" />

The server will restart gracefully and redirect you to the sign in form.

Optional steps

If you want to verify PHP version, you can type the below command:

/usr/local/lsws/lsphp73/bin/lsphp -v

<img class="alignnone wp-image-53 size-full" src="/uploads/2019/04/php_version.png" alt="" width="713" height="134" />

Similarly, to check MySQL version

mysql -V

<img class="alignnone wp-image-54 size-full" src="/uploads/2019/04/mysql_version.png" alt="" width="733" height="67" srcset="/uploads/2019/04/mysql_version.png 733w, /uploads/2019/04/mysql_version-730x67.png 730w" sizes="(max-width: 733px) 100vw, 733px" />

Congratulation! You have successfully installed OpenLiteSpeed Web Server in your system. Now you can either add a domain name or install WordPress on your server.