How to enable full/advanced WordFence protection on OpenLiteSpeed

Website security is always a fundamental and important part of any website especially WordPress. Today we will see how to enable full/advanced Wordfence protection on OpenLiteSpeed.

If you are using LiteSpeed Enterprise you don’t need to do anything as it is fully Apache compatible so Wordfence full protection will work out of the box. So you can stop now and enjoy your coffee.

However, if you are using OpenLiteSpeed then go ahead, make sure to use OpenLiteSpeed with CyberPanel, and ease your life.

What is WordFence?

Wordfence is one of the most popular WordPress scanner and firewalls. Wordfence comes in both free and premium versions. Wordfence has enough features to secure your websites like endpoint firewall, malware scanner, malicious IP addresses detection, 2FA, and all. In short, Wordfence is the most comprehensive WordPress security solution available. Wordfence is enough to secure your site.

Why do we need to configure OpenLiteSpeed for full Wordfence protection?

Setting up WordFence is a bit tricky in the case of OpenliteSpeed. With OpenLiteSpeed, you have to do some manual settings. In this article, we will discuss how to configure Wordfence with OpenliteSpeed to enable advanced firewall options.

Enable full Wordfence protection on OpenLiteSpeed:

  1. Install Wordfence on your WordPress site.
  2. Edit Vhost Configuration for Wordfence.
  3. Enable full Wordfence protection with CyberPanel.

Install Wordfence on your WordPress site:

The installation of Wordfence on your WordPress site is just like the installation on any plugin. Follow along the steps to install Wordfence.

Setp 1: Install Wordfence Plugin:

To install WordFence on your WordPress site first log in to your admin dashboard:

Go Plugins->add New

advanced wordfence protection on openlitespeed

Now search Wordfence in the search bar, You will receive the results for Wordfence select the first one (The one with the Wordfence logo) and Click install.

image 64

Setp 2: Setup Wordfence Plugin:

Once installation is done click Activate to activate the plugin:

image 65

After activation, they will ask you for an email address where they sent you emails regarding your website. Provide your email, click yes if you want to receive emails, check the box for agreement and press continue.

image 67

If you have a premium version enter the key here otherwise click on thanks and use the free version.

image 68

Now your Wordfence is installed and good to go. You can see the Wordfence on the left menu. When you click that you will see a notice to configure full/extended Wordfence protection.

image 69

Once you click the configuration a prompt appears that asks to download the .htaccess file. Click on download and press continue.

image 70

In the case of LiteSpeed Ent. configuration is done out of the box but in the case of OpenLiteSpeed, we’ve to perform some additional steps that we will discuss below. I found an official video guide for you to install Wordfence you can check that also.

Edit Vhost Configuration for Wordfence:

For OpenLiteSpeed you have to configure the Wordfence to enable Advanced WordPress Protection. Without setting these configurations to OpenLiteSpeed you can see that there is the Basic WordPress Protection.

image 71

To enable the advanced protection you have to access the OpenliteSpeed web server dashboard by navigating https://<your_ip>:7080. In the OpenLiteSpeed web, server Dashboard go to the VHost -> General

image 72

Go the end of page you will find the php.ini overwrite click the edit button.

image 73

add this to php.ini overwrite

php_value auto_prepend_file /path/to/wordfence-waf.php

Most Common path if you created site from cyberpanel

php_value auto_prepend_file /home/example.com/public_html/wordfence-waf.php

If you added the domain with CyberPanel then first you have to find the path of the wordfence-waf.php file. After adding this graceful restart the OpenLiteSpeed with this server did not get the changes.

image 74

Once done go back to your WordPress site and check the firewall you can see the Extended Protection level there.

image 75

Instead of doing this from the OpenLiteSpeed, you can install CyberPanel on your OpenLiteSpeed server, and then there is an easy way to do this. I will describe that in the next step.

Enable advanced firewall with CyberPanel.

When you have the CyberPanel installed on your server to manage your site you can follow the guide stated above but in this part of the article, I will tell you a simple way to do this using CyberPanel. To enable an extended or advanced level of protection using CyberPanel, you have to log in to CyberPanel using your credentials.

From you CyberPanel Dashboard go to the Websites ->list websites

image 76

You can see all of your websites there Click on the Manage button. To open the website dashboard.

image 77

Once the manage Dashboard for the web site is opened go to the configuration part and click the VHost

image 78

Go to the php.ini section

image 79

Add the following line to enable the extended protection.

php_value auto_prepend_file /home/example.com/public_html/wordfence-waf.php 

Now your extended protection is enabled .

image 81

Follow US on Facebook / Twitter  for update.

How to configure Redis Object caching for WordPress on CyberPanel

Redis is open-source software that is used as a database cache. At times when MySQL becomes a bottleneck for your WordPress installation due to heavy queries, Redis can help reduce that load by using in-memory data structure storage. In this article, we will see how to configure Redis Object Caching for WordPress on CyberPanel using the Redis plugin.

CyberPanel is one of the emerging and popular choices among web hosting control panels and with its current new feature timeline, CyberPanel developers are introducing more and more features into it. With a team that is very quick with updates and bug fixes, CyberPanel is becoming one of the first choices for a free hosting panel.

Currently, CyberPanel stable version is v2.0.3, and the CyberPanel team is about to launch the next version very soon. The v2.0.3 version includes very exciting features and one of those features which CyberPanel has introduced is the Redis Application installation with PHP extension.

Table Of Content:

  1. How to install Or upgrade the CyberPanel :
  2. Install Redis and Redis PHP extension on CyberPanel.
  3. Install Redis Plugin on WordPress.
  4. Redis setup with Redis WordPress plugins.
  5. Benchmarks

How to install Or upgrade CyberPanel:

If you are looking for how to install CyberPanel? Then you are in the right place and if you are looking for how to get the latest version of CyberPanel then this article will tell you how you can upgrade CyberPanel to the latest version.

How to install CyberPanel:

Honestly, CyberPanel installation is very easy. It takes 5-20 minutes to install depending on your server specs, and one command to run.

sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)

But I recommend you to also read CyberPanel Official tutorial for this.

How to Upgrade CyberPanel:

You can also update CyberPanel using only one command and as the installation, it also takes 5 minutes and a single command.

sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)

You can read the official guide for this also.

Install Redis and Redis PHP extension on CyberPanel

First of all, I am going with a short introduction to Redis. I know most of you know what Redis is and what are the uses of Redis. But some may be new to Redis so let me explain what it is.

Redis is an in-memory data structure store. Redis is used for caching, Session management, Subscriber base messages. Basically, Redis makes the process quicker. Let me be clear with an example of Twitter. Twitter is using Redis for subscribing, Liking, and all of that. You notice that when we have a new feed on twitter the whole page is not refreshed and you can see the message-like.

image 58

That is Redis. That did not allow the refresh of the whole page but adds the new content. Redis is an effective component to improve the speed of the site. If you want to know more about Redis goto there official site by clicking here.

Do you know? You can install Redis using CyberPanel in one click. CyberPanel developers added this new feature to install the Redis directly from the CyberPanel.

In the previous version of CyberPanel, if you wanted to install Redis and configure, you were required to install it using commands and then you have to install Redis extension from PHP extensions from CyberPanel. But this hustle is about to end in v2.0.3. Now CyberPanel makes it easy for its users.

I am going to explain what you have to do now in v2.0.3.

Install Redis:

To Install Redis first you must have a CyberPanel version v2.0.3. If you have this version then go to https://<your_ip>:8090/ and log in by providing credentials.

image 59

Once you login to your system now go to the ‘Manage Services->Applications‘. Let me make it more clear. Visit this link to install Redis https://<Your_IP>/manageservices/manageApplications.

image 60

Once you reach this page. No matter through the Option Stated above or using the link. You can see the option to install Redis Daemon.

Configure Redis Object Caching for WordPress on CyberPanel

Now to Click install button present in front of the Redis on your screen.

image 63

Now the real process starts. Once you click the window you can see a popup window appear which shows you the installation process and at the end of the process, you can see the version and all about the Redis information.

image 65

Once Installation is completed the page refreshes automatically and you can see that Redis is now installed, How cool is this?

For the removal of Redis, there is also one click in CyberPanel v2.0.3. You can see the status of Redis that it is installed and you can uninstall it by just clicking the remove button on the same page.

image 67

This one-click installation is an amazing feature in CyberPanel. Now you are done with the Redis installation its time to install the Redis PHP extension. For this follow the next step.

Install Redis Extension in CyberPanel:

Its time to install the Redis extension on CyberPanel. As you all know this one is not a new feature in CyberPanel. For the installation of Redis Extension go to the PPH->Install Extensions. You know we have an alternate path to access this point also and that is the link https://<Your_IP>/managephp/installExtensions

image 68

When you are on this page. Here you have to select a PHP version to install the extension for. Mostly the version that you are using for your site on which you want to setup Redis.

image 69

Select the required version and install the Redis extension for this version. For me, I selected PHP 7.4 for installation. Because I use this for my site. After selection, you search Redis in the search box and you get the required result. And you can see the install button.

image 71

Once you clicked the install button you can see the installation process.

image 72

After Installation go back and check the status of the extension.

image 74

All done from the CyberPanel. Now its time to setup on your WordPress site.

Install Redis Plugin on WordPress:

Now its time to install Redis on WordPress. The installation of every plugin is almost the same.

  1. Go to the admin dashboard in wp-admin
  2. Go to plugin
  3. Add new
  4. Search Redis in the bar and you can see the Redis plugin
  5. Click on install and then activate
image 56

Benchmark of WordPress site with and without Redis setup:

After activating this plugin now we are going to perform a benchmark for Redis which shows the difference after and before Redis results.

For both type of benchmark we select a constant value of data

h2load -n10000 -c100 -m10 https://ourdomain.com/

We are goin to use this command that mean we have three parameters here:

-n The number of total requests. we are going with 10000

-c The number of concurrent clients. we are going with 100

-m The max concurrent streams to issue per client. we are going with 10

Results Before enabling Redis:

According to the command motioned above we have the following results for our benchmark without enabling Redis.

image 58
[root@cento ~]# h2load -n10000 -c100 -m10 https://shoaibkhankhattak.tk/
starting benchmark…
spawning thread #0: 100 total client(s). 10000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES128-GCM-SHA256
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done
finished in 208.14s, 48.04 req/s, 1.19MB/s
requests: 10000 total, 10000 started, 10000 done, 10000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 10000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 248.57MB (260644306) total, 145.97KB (149469) headers (space savings 95.87%), 247.74MB (259770000) data
min max mean sd +/- sd
time for request: 104.87ms 67.20s 14.39s 11.88s 90.34%
time for connect: 102.45ms 162.19ms 144.00ms 22.98ms 76.00%
time to 1st byte: 158.23ms 67.16s 24.80s 24.80s 76.00%
req/s : 0.48 1.75 0.96 0.57 60.00%
image 60
Mean time stats

Benchmark results After enabling Redis:

First of all you have to enable Redis for that Go to Admin Dashboard then Settings->Redis->Enable Object cache

image 59

Now we will look for the bencmark results:

image 61
starting benchmark…
spawning thread #0: 100 total client(s). 10000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES128-GCM-SHA256
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done
finished in 180.50s, 55.40 req/s, 1.38MB/s
requests: 10000 total, 10000 started, 10000 done, 9991 succeeded, 9 failed, 0 errored, 0 timeout
status codes: 9991 2xx, 0 3xx, 0 4xx, 9 5xx
traffic: 249.24MB (261343519) total, 149.02KB (152593) headers (space savings 95.78%), 248.40MB (260466602) data
min max mean sd +/- sd
time for request: 20.74ms 180.35s 11.68s 11.02s 91.20%
time for connect: 90.91ms 251.48ms 148.32ms 36.94ms 73.00%
time to 1st byte: 172.45ms 54.38s 13.31s 15.11s 81.00%
req/s : 0.55 1.25 0.95 0.29 56.00%
image 62

OpenLiteSpeed vs NGINX

Updated: On 22 September 2020.

OpenLiteSpeed is an open-source version of LiteSpeed Enterprise Web Server that shares the same code base so the same Enterprise-Grade performance. Today we will see the performance of openlitespeed vs nginx and we will look into various scenarios such as;

  1. Static file performance of openlitespeed vs nginx.
  2. Simple PHP file performance.
  3. WordPress site performance with and without LSCache and FastCGI Cache for NGINX.
Continue reading “OpenLiteSpeed vs NGINX”