قالب وردپرس درنا توس
Home / How To / How to install and configure OpenLiteSpeed ​​with PHP 7.4 on CentOS 8

How to install and configure OpenLiteSpeed ​​with PHP 7.4 on CentOS 8



OpenLiteSpeed ​​is an open-source HTTP server developed by LiteSpeed ​​Technologies. It is a high performance and lightweight HTTP server with a web based GUI for administration.

OpenLiteSpeed ​​can handle more than one hundred thousand concurrent connections with low resource consumption (CPU and RAM) and supports many operating systems such as Linux, Mac OS, FreeBSD and SunOS. The server can be used to run websites written in PHP, Ruby, Perl and Java.

In this tutorial, we will show you how to install OpenLiteSpeed ​​with the MariaDB database and the current PHP 7.4 on the current CentOS 8 server.

Prerequisites

For this guide, we will use the latest CentOS 8 server with 2 GB RAM, 25 GB free disk space and 2 CPU.

What we will do:

  • Install OpenLiteSpeed ​​
  • Install PHP 7.4 OpenLiteSpeed ​​version
  • Install MariaDB Database
  • Setup OpenLiteSpeed ​​Admin
  • Configure OpenLiteSpeed with PHP 7.4
  • Running OpenLiteSpeed ​​1
    96 Testing
  • ] Step 1 – Install OpenLiteSpeed ​​

    First, we add the openliteSpeed ​​archive and install the OpenLiteSpeed ​​web server from it.

    Add the OpenLiteSpeed ​​archive for CentOS 8 with the command below.

      rpm -Uvh http: / /rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.no arch.rpm 

    Then check all available repositories on the CentOS system.

      dnf repolist 

    And you will get the result as below.

     Check repository with dnf [19659002] As a result, you have added the OpenLiteSpeed ​​layer to the CentOS 8 system.

    Now install the OpenLiteSpeed ​​package with the dnf command below.

      sudo dnf install open openespeed 

    When the installation is complete, start the OpenLiteSpeed ​​service and add it to the system boot.

      systemctl start lsws 
    systemctl enable lsws

    Now check the openlitespeed service.

      systemctl status lsws 

    OpenLitespeed is running on the CentOS 8 system.

     Start OpenLitespeed on CentOS

    As a result, you have installed the openlitespeed web server on the CentOS 8 server.

    Step 2 – Install PHP 7.4

    After installing the openlitespeed web server, we will install the latest PHP 7.4 f or openlitespeed called & # 39; LSPHP & # 39; or (LSAPI and PHP).

    Before installing PHP 7.4 packages, add the EPEL layer to the system.

      sudo dnf install epel release 

    Then install LSPHP packages from the official OpenLitespeed layer with the following command.

      sudo dnf install lsphp74 lsphp74-mysqlnd lsphp74 process lsphp74-mbstring lsphp74-mcrypt lsphp74-gd lsphp74-opcache lsphp74-php74 lphphs installation is complete, check PHP command socketf below. 

      netstat -pl | grep lsphp 

    And PHP 7.4 for OpenLitespeed is running.

     Check lsphp

    As a result, you have installed PHP 7.4 package for openlitespeed web server.

    Step 3 - Install MariaDB

    In this step, we install the MariaDB server and set its root password.

    Install the MariaDB server with the dnf command below.

      sudo dnf install mariadb mariadb server 

    When the installation is complete, launch the MariaDB service and add it at start time.

      systecmtl start mariadb 
    systemctl enable mariadb

    The MariaDB service is now running.

    Then we set up the root password for the database server. And we will use the command line tool & # 39; mysql_secure_installation & # 39; for it.

     Install MariaDB

    Run the "mysql_secure_instalaltion" command below.

      mysql_secure_installation 

    Now enter the root password type & # 39; Y & # 39; for the rest of all configuration.

      Set a root password? [Y/n] Y 
    Remove anonymous users? [Y/n] Y
    Delete the test database and access it? [Y/n] Y
    Reload privilege tables now? [Y/n] Y

    And configuration MariaDB root password is complete.

    Now log in to the MySQL shell with the root user as below.

      mysql -u root -p 
    Enter your root password:

    After logging in, check the user on the MariaDB system with the following question.

      select User, Password, Host from mysql.user; 

    And you will get the result as below. [19659002]   Set MySQL root password

    As a result, you have successfully installed the MariaDB database server and configured the root password authentication for it.

    Step 4 - Setup Admin Authentication

    OpenLiteSpeed ​​provides a web-based dashboard to manage its configuration.

    In this step, we open port & # 39; 7080 & # 39; on the firewall rules and sets user and password authentication for the OpenLiteSpeed ​​dashboard.

    By default, the openlitespeed dashboard is run on port & # 39; 7080 & # 39 ;. And we add the port & # 39; 7080 & # 39; to the firewall.

    Add port & # 39; 7080 & # 39; to the firewall rules and reload the service using the & # 39; firewall-cmd & # 39; below.

      firewall-cmd --add-port = 7080 / tcp --permanent 
    firewall-cmd - load

    And you added the OpenLitespeed dashboard port & # 39; 7080 & # 39; to CentOS firewall.

    Then we set up the OpenLitespeed control panel.

    Go to directory & # 39; / usr / local / lsws / admin / misc & # 39; and run the script & # 39; admpass.sh & # 39 ;.

      cd / usr / local / lsws / admin / misc 
    sh admpass.sh

    Enter your administrator user and password and you have set the authentication for the OpenLitespeed admin dashboard.

     Protect the OpenLitespeed admin dashboard

    Now open your browser and enter the server IP address followed by the port & # 39; 7080 & # 39; in the address field.

    https://10.5.5.25:7080/

    Log in with your username and password. [19659002]   Log in to OpenLitespeed

    When the user and password are correct you will receive the OpenLitespeed admin dashboard as below.

     OpenLitespeed admin dashboard

    As a result, "We have successfully configured openlitespeed admin authentication.

    Step 5 - Configure OpenLiteSpeed ​​with PHP 7.4

    This step comes we set PHP 7.4 for OpenLiteSpeed ​​with the web-based administration.

    On the OpenLiteSpeed ​​dashboard, click on the menu & # 39; Server configuration "on the left and click on the" External app "tab [19659084].

     Configure OpenLiteSpeed ​​with PHP 7.4

    To add the new PHP 7.4 configuration, click Add & # 39; + & # 39; to the right.

    For the type, select & # 39; LiteSpeed ​​SAPI App "and click" Next button.

     LiteSpeed ​​SAPI app

    Now enter information configuration as below.

      Name: lsphp74 
    Address: uts: //tmp/lshttpd/lsphp.sock
    Notes: lsphp74 for OpenLiteSpeed ​​
    Max Connections: 35
    Initial Request Timeout (sec): 60
    Try Timeout (sec): 0
    Command: $ SERVER_ROOT / lsphp74 / bin / lsphp

    And click & # 39; Save & # 39; and the PHP 7.4 configuration has been added.

     PHP 7.4 configuration

    Then we will change the default PHP for OpenLiteSpeed ​​to PHP 7.4 version.

    In the " Server Configuration " menu, click " Script Handler ".

     Script Handler

    Now click on the " Edit " button in the action section.

    On "Merchant Name, Select" lsphp74 "that we just added and click on" Save ".

     lsphp74

    And as a result, you have added and enabled PHP 7.4 configuration for OpenLiteSpeed.

     PHP 7.4 configuration for OpenLiteSpeed ​​

    Step 6 - Run OpenLiteSpeed ​​on Port 80

    As by default, OpenLiteSpeed ​​runs as the default port " 8088 . To run OpenLiteSpeed ​​on the default port & # 39; 80 & # 39 ;, we can use the administration panel to change the configuration.

    In this step, we add the HTTP and HTTPS service to the list of firewall services and set OpenLitespeed to run on the http port & # 39; 80 & # 39;

    Add the HTTP and https services to the firewall with the following command.

      firewall-cmd --add-service = http --permanent 
    firewall-cmd --add -service = https --permanent

    Reload the firewall now.

      firewall cmd - load 

    And you added the HTTP and HTTPS services to the firewall.

    <img src = "https://www.howtoforge.com/images/how-to-install-openlitespeed-with-php_7-on-centos_8/19.png" alt = "Configure Firewalld

    " width = "750" height = "193" style = "display: block; margin-left: auto; margin-right: auto;" />

    Then return to the OpenLitespeed admin dashboard in your browser and click the & # menu 39; Listener on the left.

     OpenLitespeed Listers

    On the & # 39; Standard & # 39; listener, click & # 39; view & # 39 ;.

    On the " Address Settings section, click the & # 39; edit & # 39; button on the right.

     Address settings

    Now change the port to the default HTTP port " 80 " and click on the " Save button.

     Configure http port

    And the default port for OpenLiteSpeed ​​has been changed to the HTTP port default " 80 & # 39;

    Now click on the restart button and The OpenLiteSpeed ​​service is restarted.

     Restart the server after changing the configuration

    As a result, OpenLiteSpeed ​​now runs the default HTTP port & # 39; 80 & # 39; [19659122] Step 7 - Test

    Open your browser and enter the server IP address in the address bar.

    http://10.5.5.25/

    And you get the default index page for OpenLiteSpeed.

     OpenLitespeed successfully installed

    Then we test PHP configuration and make sure it works.

    In the " Test PHP " section, click button " click here ".

    And you will get the phpinfo page down n.

     PHL Information about OpenLitespeed

    As a result, you have installed the OpenLiteSpeed ​​web server with the MariaDB database and PHP 7.4 on CentOS 8 Server.

    Reference


Source link