Introduction:
OpenLiteSpeed is a high-performance HTTP server, and it can handle hundreds and thousands of simultaneous connections with very low resource consumptions.
Setup openlitespeed Respository:
Use the following command to add the OpenLiteSpeed repository.
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm Output:
Install openLiteSpeed on CentOS 7:
Now, install OpenLiteSpeed 1.4.26 (chck) using YUM command.
yum -y install openlitespeed
Run the following command to check the version of OpenLiteSpeed and its modules.
/usr/local/lsws/bin/lshttpd -v
Output:
Controlling OpenLiteSpeed
To Start OpenLiteSpeed, run:
/usr/local/lsws/bin/lswsctrl start
To Stop OpenLiteSpeed, run:
/usr/local/lsws/bin/lswsctrl stop
To Restart OpenLiteSpeed, run:
/usr/local/lsws/bin/lswsctrl restart
To check the running status of OpenLiteSpeed, run:
/usr/local/lsws/bin/lswsctrl status
Output:
By default, OpenLiteSpeed listens on port 8088. So, you need to add firewall rules to allow port 8088 for accessing the web server.
firewall-cmd --zone=public --permanent --add-port=8088/tcp firewall-cmd --reload
Enter the URL with port no 8088 and see whether you can able to access OpenLiteSpeed or not.
OR
Install MariaDB Server
We will now install the MariaDB server by using YUM command.
yum -y install mariadb mariadb-server
Start MariaDB server.
systemctl start mariadb
Set MariaDB service to start during every boot.
systemctl enable mariadb
Install PHP
As said in features of OpenLiteSpeed, it supports different versions of PHP installation, so we will configure OpenLiteSpeed with both PHP v5.6 and V7.0. Add EPEL repository for getting dependent packages for PHP.
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
OpenLiteSpeed with PHP 5.6 support:
yum install -y lsphp56 lsphp56-common lsphp56-mysql lsphp56-gd lsphp56-process lsphp56-mbstring lsphp56-xml lsphp56-mcrypt lsphp56-pdo lsphp56-imap lsphp56-soap lsphp56-bcmath
OpenLiteSpeed with PHP 7.0 support:
yum install lsphp70 lsphp70-common lsphp70-mysqlnd lsphp70-gd lsphp70-process lsphp70-mbstring lsphp70-xml lsphp70-mcrypt lsphp70-pdo lsphp70-imap lsphp70-soap lsphp70-bcmath
Configure OpenLiteSpeed
In this section, we will setup OpenLiteSpeed with both PHP 5.6 & PHP 7.0, Also we will configure OpenLiteSpeed to listen on standard HTPP port 80 and via WebAdmin console.
By Default, WebAdmin console listens on port 7080 and tThe default account of OpenLiteSpeed is,
Username: admin
Password: 123456
I recommend you to change the default password for security reason. To change the password of OpenLigtSpeed admin console, run the following command.
/usr/local/lsws/admin/misc/admpass.sh
Output:
Access WebAdmin Console
Open a web browser and visit the following URL.
OR
Login with the admin account and the password you set few steps before
Configure OpenLiteSpeed with PHP 5.6:
You do not have to do any configuration changes to OpenLiteSpeed as it uses PHP 5.6 by default.
Configure OpenLiteSpeed with PHP 7.0:
As I said earlier, OpenLiteSpeed uses PHP 5.6. To have PHP 7.0 with OpenLiteSpeed, follow the below steps.
We already have PHP 7.0 on the server. So, go to “Server Configuration” –> “External App” –> “Add“.
Select “LiteSpeed SAPI App” and then click Next,
Add the below configuration,
Name: lsphp7 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 (secs): 0 Persistent Connection: Yes Response Buffering: No Auto Start : Yes Command: /usr/local/lsws/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 save button to save the configuration.
Modify the default script handler to use PHP 7.0. To do that, go to “Server Configuration” –> “Script Handler” –> Edit lsphp5.
Update with the following configurations.
Suffixes: php Handler Type: liteSpeed SAPI Handler Name: lsphp7 Click the save icon.
Configure OpenLiteSpeed to use port 80:
Go to “Listeners” and click on “Zoom icon” in the Default listener to view the configuration.
Edit the listener.
Update with the following information.
IP Address: ANY Port : 80
Click on the save icon.
Finally, restart the OpenLiteSpeed server.
Verify OpenLiteSpeed server:
Just enter the URL without port number and see whether you can able to access OpenLiteSpeed.
OR
The above page confirms that the OpenLiteSpeed is listening on Standard HTTP port 80.
Verify support for PHP in OpenLiteSpeed
Visit the following URL using your favorite web browser.
OR
You can see the output like below.
That’s all now you can come to know about the installing of OpenLiteSpeed, PHP 7.0 & MariaDB on CentOS 7 /
And to know about to increase php memory click here.