Home / How To / How to install OpenLiteSpeed ​​HTTP server with PHP on Ubuntu 18.04 LTS

How to install OpenLiteSpeed ​​HTTP server with PHP on Ubuntu 18.04 LTS

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 web page scripts 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 Ubuntu 18.04 server.


For this guide we will use the latest Ubuntu 1

8.04 server with 2 GB RAM, 25 GB free hard 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
  • Run OpenLiteSpeed ​​on Port 80 Test
  • 1 – Install OpenLiteSpeed ​​

    First, we add the official OpenLiteSpeed ​​archive for Ubuntu 18.04 and install OpenLiteSpeed ​​

    To add OpenLiteSpeed ​​archive, download the bash script and run it with the command as below.

      wget - O - http://rpms.litespeedtech.com/de bian / enable_lst_debain_repo.sh | bash 

    Then install OpenLiteSpeed ​​using the apt command below.

      sudo apt install openlitespeed -y 

    When installation is complete, check the service status of OpenliteSpeed.

      systemctl status openlitespeed 

    And you will get OpenLiteSpeed ​​running.

    Now check the port used by OpenLiteSpeed.

      netstat -plntu 

    And you get the OpenLiteSpeed ​​service that uses two standard ports & # 39; 8080 & # 39; by default HTTP access and port & # 39; 8070 & # 39; for OpenLiteSpeed ​​admin access.

     Check if OpenLitesSpeed ​​is running

    Step 2 – Install PHP 7.4 OpenLiteSpeed ​​version

    After installing OpenLiteSpeed, we will install the latest PHP 7.4 for OpenLiteSpeed. The OpenLiteSpeed ​​PHP packages are called & # 39; LSPHP & # 39; (LSAPI and PHP).

    Install PHP 7.4 package for OpenLiteSpeed ​​using the apt command below.

      sudo apt install lsphp74 lsphp74-common lsphp74-mysql lsphp74-dev lsphp74-curl lsphp74-dbg -y 

    Now you have installed PHP 7.4 package for OpenLiteSpeed, it comes as a system stream file.

    Check it with the netstat command below.

      netstat -pl | grep lsphp 

    And you will get the LSPHP sock file as below.

     Install PHP 7.4 for OpenLitespeed

    Step 3 – Install and configure MySQL

    in this step we will install the MariaDB server and set the root password for it.

    Install the MariaDB server using the apt command below.

      sudo apt install mariadb-client mariadb server 

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

      systecmtl start mariadb 
    systemctl enable mariadb

    The MariaDB service is now running.

    Next, we will set up the root password for the database server. And we will use the command line tool "mysql_secure_installation" for that.

    Run the "mysql_secure_instalaltion" command below.


    Now type the root password and type "Y" for the rest of all configuration.

      Do you 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 the configuration MariaDB root password is ready.

    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]   Configure MariaDB

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

    Step 4 – Setup OpenLiteSpeed ​​Admin

    OpenLiteSpeed ​​provides a web-based dashboard for managing its configuration.

    In this step, we set up user and password authentication for the OpenLiteSpeed ​​dashboard.

    Go to directory & # 39; / usr / local / lsws / admin / misc / & # 39; and you get some tools, now run the bash script & # 39; admpass.sh & # 39; as below.

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

    Enter your username and password and you have completed the configuration of OpenLiteSpeed ​​authentication.

     Setting OpenLiteSpeed ​​Admin

    Now open your browser and type the server IP address followed by openliteSpeed ​​admin port & # 39; 7080 & # 39 ;. My are:

    And you will get the OpenLiteSpeed ​​admin dashboard.

    <img src = "https://www.howtoforge.com/images/how_to_install_and_configure_openlitespeed_with_php_71_on_ubuntu_1804/5.png" alt = "OpenLiteSpeed ​​admin login

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

    Type your username and password and then click on the " Login .

    Now you will get the administration panel for OpenLiteSpeed ​​as below.

     OpenLiteSpeed ​​admin dashboard

    As a result, you have successfully configured OpenLiteSpeed ​​admin panel

    Step 5 – Configure OpenLiteSpeed ​​with PHP 7.4

    In this step, we will set PHP 7.4 for OpenLiteSpeed ​​with the web-based administration.

    On the OpenLiteSpeed ​​dashboard, click " Server Configuration " on the left and click " External app ".

     Configure OpenLiteSpeed ​​with PHP 7.4

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

    For the type, select " LiteSpeed ​​SAPI App " and click the " 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
    Retry timeout (sec): 0
    Command: $ SERVER_ROOT / lsphp74 / bin / lsphp

    and click & # 39; Save button and PHP 7.4 configuration has added.

     PHP 7.4 SAPI binding

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

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

     Script Handler

    Now click on the " Edit " button on the Actions section. [19659002] Select " lsphp74 " on the "Handler name" we just added and click on the " Save .

     lsphp74 [19659002] And as you have added and enabled the PHP 7.4 configuration for OpenLiteSpeed.

    Step 6 – Run OpenLiteSpeed ​​on Port 80

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

    On the OpenliteSpeed ​​dashboard, click the & # 39; Listener "on the left.

     un OpenLiteSpeed ​​on Port 80

    On" Default "listener, click on" show "button.

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

     Internet Address Settings

    Now change the port to the default HTTP port " 80 & # 39; and click & # 39; Save & # 39; .

     Change port that LiteSpeed ​​listens to

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

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

     Restarted the service

    As a result t, OpenLiteSpeed ​​now runs on standard HTTP port & # 39; 80 & # 39 ;

    Step 7 – Test

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

    And you get the default index page for OpenLiteSpeed.

     Test OpenLiteSpeed ​​

    Next, we test the PHP configuration and make sure it works.

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

    And you get the phpinfo page as below.

     PHP Information for PHP 7.4 on OpenLiteSpeed ​​

    As a result, you have installed the OpenLiteSpeed ​​web server with the MariaDB database and PHP 7.4 on Ubuntu 18.04 Server. [19659112] Reference

Source link