Hello, friends. We’ve been testing a great web server for a while now. So, in this post, we’ll show you how to install OpenLiteSpeed on CentOS 8.
What is OpenLiteSpeed?
OpenLiteSpeed is an open source web server, released under the GPL license that guarantees access to the code. According to the official website of the project, OpenLiteSpeed combines speed, security, scalability, optimization and simplicity in one friendly open-source package.
On the other hand, it has quite peculiar characteristics that make it easy to access without losing robustness.
Another important aspect to emphasize is that this is the free version of LiteSpeed web server. Therefore, stability and robustness are guaranteed.
OpenLiteSpeed features
OpenLiteSpeed comes with a number of important features such as the following:
- It has enormous scalability. Thanks to an event driven architecture.
- It is able to understand Apache rewriting rules. Which makes if you have used this web server, the transition is easy.
- It allows to install WordPress, MariaDB and the server with a single click.
- It integrates strong security measures. This mitigates attacks and performance issues.
- Integrates Google’s web site acceleration system.
- Native SAPI for PHP allows external applications written in PHP to run up to 50% faster.
So, let us install it.
Install OpenLiteSpeed on CentOS 8
By default, OpenLiteSpeed is not in the CentOS repositories so other methods must be used.
So, open a terminal or login to your server and become root.
su
Then, install the RPM package to add the OpenLiteSpeed for CentOS repository. We can do it by executing the following command:
rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.2-1.el8.noarch.rpm Retrieving http://rpms.litespeedtech.com/centos/litespeed-repo-1.2-1.el8.noarch.rpm Verifying… ################################# [100%] Preparing… ################################# [100%] Updating / installing… 1:litespeed-repo-1.2-1.el8 ################################# [100%]
Then, you have to enable the EPEL repository which contains some dependencies that are required to install OpenLiteSpeed. This can be done by running it:
dnf install epel-release
And later, we can install OpenLiteSpeed:
dnf install openlitespeed
Since CentOS 8 does not start the services after installation, then we have to do it manually.
systemctl start lsws
In this same situation, we can enable OpenLiteSpeed to start with the system:
systemctl enable lsws
And finally, check the status of the service.
systemctl status lsws ● lshttpd.service - OpenLiteSpeed HTTP Server Loaded: loaded (/usr/lib/systemd/system/lshttpd.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2020-11-12 15:13:20 EST; 28s ago Main PID: 1222 (litespeed) CGroup: /system.slice/lshttpd.service ├─1222 openlitespeed (lshttpd - main) ├─1230 openlitespeed (lscgid) ├─1245 openlitespeed (lshttpd - #01) └─1246 lsphp Nov 12 15:13:15 osradar systemd[1]: Starting OpenLiteSpeed HTTP Server… Nov 12 15:13:18 osradar lswsctrl[1198]: [OK] litespeed: pid=1222. Nov 12 15:13:20 osradar systemd[1]: Started OpenLiteSpeed HTTP Server.
The OpenLiteSpeed administration panel runs on port 7080
, so you have to open it in the Firewall.
In addition, you should open the HTTP and HTTPS ports which are 80
and 443
.
firewall-cmd --add-port=7080/tcp --permanent
success
firewall-cmd --add-service=http --permanent
success
firewall-cmd --add-service=https --permanent
success
Finally, restart the Firewalld daemon to apply the changes.
firewall-cmd --reload
success
The next step is to create an administrator user who will manage the OpenLiteSpeed administration panel. So, go to the /usr/local/lsws/admin/misc
folder
cd /usr/local/lsws/admin/misc
And run the admpass.sh
script
sh admpass.sh 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: Retype password: Administrator's username/password is updated successfully!
There you create the user together with the password.
So, now you know that the program is running correctly and we can install PHP.
2.- Install PHP 7.4 on CentOS 8
As a dependency, OpenLiteSpeed comes as PHP 7.3 and although it is a good version of PHP, it is also the latest. So in many cases, it is convenient to have PHP 7.4
To do this, run the following command:
dnf install lsphp74 lsphp74-mysqlnd lsphp74-process lsphp74-mbstring lsphp74-mcrypt lsphp74-gd lsphp74-opcache lsphp74-bcmath lsphp74-pdo lsphp74-common lsphp74-xml
As you can see, we have not only installed PHP but also some of the most important modules.
3.- Install MariaDB on CentOS 8(Optional)
Although it is not mandatory, we can complete the webserver by adding MariaDB in CentOS 8. This is very easy, to do it, just run:
dnf install mariadb mariadb-server
Once it has been installed, the MariaDB service must be started:
systemctl start mariadb
Now, have MariaDB run at startup:
systemctl enable mariadb
Then, you can define a password for the root user in MariaDB thanks to the mysql_secure_installation script and use it to secure the installation.
mysql_secure_installation
And in the questions, it answers all Y
Set root password? [Y/n]
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
4.- Configuring OpenLiteSpeed on CentOS 8
Now, we will be able to access the OpenLiteSpeed panel. Open a web browser and go to http://your-server:7080
and you will see the login screen where you have to enter your data:
When you do it and log in, you will be able to see the dashboard.
We have installed, PHP 7.4 for OpenLiteSpeed but we have to add it to the settings and define it to be the default interpreter. To do this, go to Server Configuration > External App tab
There click on the + button to add a new one:
In type, choose LiteSpeed SAPI App
Then click on the >| button on the right.
And add the following parameters
Name: lsphp74 Address: uds://tmp/lshttpd/lsphp.sock Notes: lsphp74 for OpenLiteSpeed Max Connections: 35 Initial Request Timeout (secs): 60 Retry Timeout (secs): 0 Command: $SERVER_ROOT/lsphp74/bin/lsphp
Then, click on the floppy-shaped button to save the changes.
It will look like this:
In the Script Handler tab, choose the handler that refers to PHP 7.4 on the Handler Name field and click on the floppy disk to save the changes.
Another configuration that we have to do is that OpenLiteSpeed processes the websites through port 8088
and usually it is port 80
.
So, go to the Listener menu and you will see all the active listener.
Then click on the magnifying glass button to see the listener values
Now, click on the edit button just right of the Address Settings section
And change the Port value to whatever you want but in this case type 80.
To apply the changes, click on the green restart button at the top of the screen.
Now if you access your server http://your-server
and you see the following.
Below you can test PHP by clicking on a button that allows us to do so –
So, OpenLiteSpeed and PHP are configured and installed correctly.
Conclusion
On this post, we have met another quite popular web server as OpenLiteSpeed. In a market dominated by Apache and Nginx it’s always nice to have other alternatives for our projects.