- Step 1 – Adding the OpenLitespeed Repository
- Step 2 – Installing OpenLiteSpeed
- Step 3 – Installing Epel Repository and PHP 7
- Step 4 – Configuring OpenLiteSpeed and PHP 7
- PHP 7 setup
- Port 80 setting
- Step 5 – Testing
- Step 6 – Changing the Administrator’s Default Port (Optional)
OpenLiteSpeed is an open source HTTP server developed by LiteSpeed Technologies. OpenLiteSpee is a performance HTTP server that comes with a Gui web administration interface. It can handle over one hundred thousand concurrent connections with low resource usage (CPU and RAM). OpenLiteSpeed supports many operating systems like Linux, Mac OS, FreeBSD and SunOS and can be used to run website scripts written in PHP, Ruby Perl, and Java.
PHP 7 is the latest version of PHP and offers better performance and lower memory consumption than PHP 5.6. It is the perfect choice for a PHP developer today.
In this tutorial, I will walk you through installing and configuring openLiteSpeed and PHP 7 on CentOS 7.
- CentOS 7 is 64-bit.
- Root privileges.
Step 1 – Adding the OpenLitespeed Repository
To install openLiteSpeed on a CentOS server, we have to add to the repository. You can add it with this command:
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
Step 2 – Installing OpenLiteSpeed
In this step, we will install openLiteSpeed 1.4. It is a stable version with many features such as PageSpeed, file uploads, support PHP 7, RCS integration and HTTP / 2 support.
So let’s install openLiteSpeed 1.4 with the following yum command:
yum -y install openlitespeed14.x86_64
Wait for the installation to complete.
Step 3 – Install Epel Repository and PHP 7
The EPEL repository is required to install PHP 7. It is available in the CentOS repository. Install the EPEL repository with the yum command:
yum -y install epel-release
Then install PHP 7 for openLiteSpeed. There is another PHP version using openLiteSpeed, PHP versions for openLiteSpeed start with “LS”. Installing PHP 7 with many of the extensions, to get a rich set of features, enter the command:
yum -y install lsphp70 lsphp70-mysqlnd lsphp70-process lsphp70-mbstring lsphp70-mcrypt lsphp70-gd lsphp70-opcache lsphp70-bcmath lsphp70-pdo lsphp70-common lsphp70-xml
If you want to see a list of all PHP extensions, you can use the yum search command:
yum search lsphp70
Step 4 – Configuring OpenLiteSpeed and PHP 7
In this step, we will be configuring openLiteSpeed and PHP 7. OpenLiteSpeed has a graphical admin interface for management, so we will set up an admin password for the openLiteSpeed GUI and then configure PHP 7 to work with openLiteSpeed and open the standard HTTP port 80.
Configuring and testing the admin GUI
To configure the admin user and password for managing the GUI, run the command below:
Enter the username and password for your GUI management.
Then open your web browser and visit the IP address of the server with port 7080.
Enter your username and password and click the “Login” button to login and you will see the openLiteSpeed panel.
PHP 7 setup
By default openLiteSpeed 1.4 uses PHP 5, in this step we will change it to PHP 7.
Php 7 is installed on the server and we just need to add a new configuration via the browser GUI.
Click on “Server Configuration” and then on the “External App” tab. You will see “lsphp5” there with the socket address. Add a new “lsphp70” by clicking on the “Add” button on the right side.
For type, use “LiteSpeed SAPI App” and click Next
Then add the config below:
Name: lsphp70 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/lsphp70/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 on the save icon to save the configuration.
Then go to the “Script Handler” tab and edit the “lsphp5” script handler 5. Change the name of the handler to “lsphp70”.
Suffixes: php Handler Type: LiteSpeed SAPI Handler Name: lsphp70
Click on the save icon.
Port 80 setting
The default HTTP port for openLiteSpeed is 8080 and is used to receive client requests. In this step, we will change port 80 from the openLiteSpeed management GUI.
On the left side, go to the “Listeners” section to see the listening configuration. You will see the default receiver with port 8080. Click the “view” icon to see detailed configuration information. Now click the “Change” button.
IP Address: ANY Port 80
Change port 80 and save the configuration.
If everything is done, restart openLiteSpeed by clicking on the restart button and click Yes to confirm.
Step 5 – Testing
We can now test the server.
Visit the IP address of the server on port 80 to verify that our configuration is working as expected.
To check your PHP configuration click on phpinfo.php.
Done and everything is working as expected.
Step 6 – Changing the Administrator’s Default Port (Optional)
This step is optional, but I would recommend changing the default GUI admin port for openLiteSpeed.
To change the default port administrator configuration, click on “WebAdmin Settings” and then “Listeners”, now click on action to change the default port.
Click on the “edit” button and enter the port for the administrator configuration, then click on the “Save” button.
Then download openLiteSpeed from your browser and check the web admin.
OpenLiteSpeed is an open source HTTP server for Linux, Windows, Mac OS and BSD developed by LiteSpeed. OpenLiteSpeed uses a different version of PHP called “lsphp” and has support for lsphp7 or PHP 7. OpenLiteSpeed is easy to customize the admin GUI so we can customize it from the browser.