How to Install OpenLiteSpeed, PHP 7.1 and MariaDB on CentOS

Tutorials 0 lượt xem
This article is part 1 of 4 in the OpenLiteSpeed ​​User Guide series

When using a shared host, I am very impressed with hosting services using LiteSpeed ​​web servers such as HawkHost , AZDigi .

Websites hosted on it using LiteSpeed ​​Cache plugin are very fast. Even many readers have found LiteSpeed ​​Cache to be better than the paid plugin WP Rocket.

So when researching VPS, I am very excited to experience LiteSpeed ​​Web Server. Fortunately, LiteSpeed ​​has an open source version for its website.

It’s called OpenLiteSpeed ​​. This is a very good performing HTTP server. It can handle a large number of concurrent connections with very few resources.

It supports both SPDY/3.1 and HTTP/2 protocols. Installing and configuring the Lets Encrypt certificate in OpenLiteSpeed ​​is very simple.

Experience OpenLiteSpeed ​​+ LiteSpeedCache after installing a WordPress website using the MyThemeShop theme for great speed.

That’s why I started to create this OpenLiteSpeed ​​series.

So you can add a choice next to two popular web servers, Apache and Nginx.

Outstanding Features of OpenLiteSpeed

  • High performance, event driven architecture
  • Very light, consumes less RAM and CPU
  • Apache-compatible rewrite rules
  • There is WebAdmin using the user interface. So many server configuration tasks are simple and intuitive. This is much less tiring than Nginx.
  • Supports many different PHP versions. In this article, I will guide you to install the latest version of PHP 7.1.

Prepare

You need to prepare the following:

  • A brand new VPS server has just installed CentOS 7. If you don’t know which VPS provider to choose, check out the quality cheap VPS services here.
  • Log in as user root using an SSH Client like MobaXTerm .

Step 1: Update the system

First you need to update the operating system with the following commands:

Step 2: Install OpenLiteSpeed

We will be installing OpenLiteSpeed ​​version 1.4.27 (at the time of this article) from OpenLiteSpeed ​​Repositories using the following commands:

A few useful commands you need to know:

To start OpenLiteSpeed ​​you use the following command:

Stop OpenLiteSpeed ​​you use the following command:

Restart OpenLiteSpeed ​​you use the following command:

Check if OpenLiteSpeed ​​is running:

Step 3: Install PHP 7.1

You use the following command to install PHP 7.1 and the necessary modules:

If you need to install any more modules, just get the module name starting with lsphp. Use the following command to view the entire module:

Step 4: Set up an Admin account for OpenLiteSpeed ​​WebAdmin GUI

The good thing about OpenLiteSpeed ​​that I say:

It provides you with a management tool in the form of a GUI called WebAdmin. All server administration operations such as adding a website will use an interface that no longer has to manipulate the command line or edit the configuration file manually.

This tool is accessed with the address: http://your_ip_address:7080. If you are using a firewall, remember to add a rule to allow access through this port.

Default account admin/12356.

You can safely edit this account by running the following command:

Enter the user and password you want:

install and configure openlitespeed 1

Ignore SSL Security warning when accessing WebAdmin. After logging in you will see the interface as below

install and configure openlitespeed 2

Step 5: Install MariaDB

About installing MariaDB, you can refer to the installation instructions in this article . Since the database is independent of the webserver, it makes no difference when you use OpenLiteSpeed.

Step 6: Configure OpenLiteSpeed ​​in WebAdmin GUI

By default OpenLiteSpeed ​​will use PHP 5.6. Now we configure OpenLiteSpeed ​​to use PHP 7.1.

Go to WebAdmin: http://your_ip_address:7080/

Go to Server Configuration -> External App -> Add :

install and configure openlitespeed 3

You select LiteSpeed ​​SAPI APP in the Type field. Click the Next button

install and configure openlitespeed 4

Add config like below:

  • Name:  lsphp71
  • Address:  uds://tmp/lshttpd/lsphp.sock
  • Max Connections:  35
  • Environment:
    • PHP_LSAPI_MAX_REQUESTS=500
    • PHP_LSAPI_CHILDREN=35
  • Initial Request Timeout (secs):  60
  • Retry Timeout :  0
  • Response Buffering:  no
  • Auto Start:  yes
  • Command:  $SERVER_ROOT/lsphp71/bin/lsphp
  • Back Log:  100
  • Instances:  1
  • Memory Soft Limit (bytes):  2047M
  • Memory Hard Limit (bytes):  2047M
  • Process Soft Limit:  400
  • Process Hard Limit:  500

Click the Save icon in the right corner to save the configuration.

Next we change the script handle to switch to PHP 7.1

Go to Server Configuration -> Script Handler . Click the Edit button .

install and configure openlitespeed 5

In Handler Type you choose lsphp71 . Click the Save icon to save it.

install and configure openlitespeed 6

Configure OpenLiteSpeed ​​to use 80 . port

By default OpenLiteSpeed ​​listens on port 8088. We will configure it to listen on port 80.

Go to Listeners and click the View button .

install and configure openlitespeed 7

Click the Edit button . Port part you switch from 8088 to 80. Click the Save icon to save.

install and configure openlitespeed 8

Click the blue Graceful Restart button in the upper right corner to apply all of the above configurations.

install and configure openlitespeed 9

Check if OpenLiteSpeed ​​is working or not

Now just type the following address on the server: http://your_ip_address

If you see the following screen, OpenLiteSpeed ​​has run successfully:

install and configure openlitespeed 10

Scroll down and click on PHP test

install and configure openlitespeed 11

You should see OpenLiteSpeed ​​using PHP 7.1

install and configure openlitespeed 12

Some configuration file locations you need to know:

Here I note the location of some configuration files

Everything about OpenLiteSpeed ​​is located in  /usr/local/lsws . It is represented in WebAdmin by the $SERVER_ROOT variable .

php.ini configuration file:

/usr/local/lsws/lsphp71/etc/php.ini

 

So you have completed the installation of OpenLiteSpeed, PHP 7.1 and Maria DB. We already have enough components to install a WordPress website.

View articles in the series

Next part: How to add website in OpenLiteSpeed ​​web server

Bài viết liên quan