How to Install OpenLiteSpeed, PHP 7.0 & MariaDB on CentOS 7
How to Install OpenLiteSpeed, PHP 7.0 & MariaDB on CentOS 7
OpenLiteSpeed is an open source web server developed by LiteSpeed Technologies, an open source version of commercial LiteSpeed web server.
OpenLiteSpeed is a high-performance HTTP server, and it can handle hundreds and thousands of simultaneous connections with very low resource consumption.
OpenLiteSpeed is available for Linux, OS X, Solaris, and FreeBSD. It supports both SPDY/3.1 and HTTP/2 network protocols.
Features of OpenLiteSpeed
- High performance, event-driven architecture.
- Lightweight, minimal CPU and memory usage.
- Apache compatible rewrite rules.
- WebAdmin GUI.
- Enhancement through available modules.
- It allows a creation of virtual hosts.
- Ships with Web proxy for page caching.
- It supports several different versions of PHP.
- Real-Time stats of web server.
Setup OpenLitespeed Repository
OpenLiteSpeed is not available in CentOS 7 software repositories, so you have to add the OpenLiteSpeed repository.
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:
Retrieving http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm Preparing... ################################# [100%] Updating / installing... 1:litespeed-repo-1.1-1.el7.centos ################################# [100%]
Install openLiteSpeed
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:
LiteSpeed/1.4.26 Open module versions: modpagespeed 1.4.24-1.11.33.3 cache 1.54 modinspector 1.1 uploadprogress 1.1
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:
litespeed is running with PID 18596.
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
Next, make the MariaDB server secure by using the mysql_secure_installation command, For installing and securing MriyaDB Click here and refer step no.2(2.Installing Mysql)
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: 12345
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:
Please specify the user name of administrator. This is the user name required to login the administration Web interface. User name [admin]: admin Please specify the administrator's password. This is the password required to login the administration Web interface. Password: Enter Password Retype password: Re Enter Password Administrator's username/password is updated successfully!
Firewall
firewall-cmd --zone=public --permanent --add-port=7080/tcp firewall-cmd --zone=public --permanent --add-port=80/tcp firewall-cmd --reload
Access WebAdmin Console
http://your-ip-address:7080
Login with the admin account and the password you set few steps before.
Dashboard:
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,
Now, 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.
http://your-ip-addr-ess/
Verify support for PHP in OpenLiteSpeed
Visit the following URL using your favorite web browser.
http://your_ip_address/phpinfo.php
Here, you can see the php information you have installed.
Hope, this article helps your need. Please share your valuable comments to improve us.
For, Installing Observium on Centos : Click here