WordPress Performance with LiteSpeed and Cloudflare

Table of Contents

This guide will teach you how to improve your WordPress performance with LiteSpeed / OpenLiteSpeed and Cloudflare CDN.

Why LiteSpeed

LiteSpeed is a caching webserver developed for speed and security by LiteSpeed Tech. LiteSpeed can handle ten times as many simultaneous connections as Apache or Nginx, according to their site.

Litespeed uses its own version of PHP – LSPHP, which is very fast compared to normal PHP.

My personal experience with LiteSpeed and WordPress has been very positive so far. I can build websites that load fast, look good and work well. Even though I host my websites on a low-powered computer in my living room, customers are happy with the speed and the security of the service. My websites load fast from all points of the world – no matter if you open them from Sofia, London, or Washington, you will get very good speeds.

If I was to host those websites on one of those heavy-hitter services, I would have to pay something like $50 to $100 per month for this performance and computer power.

But I’ve learned how to accomplish good performance with almost no money down. This allows me to have high-profit margins and if I need to, I can undercut my competitors very drastically.

Prerequisites:
A VPS or a Dedicated Server

1. Install CyberPanel server control panel​

CyberPanel is an excellent server control panel. It supports OpenLiteSpeed as a free solution, or LiteSpeed Enterprise if you have more money. Even though it’s free, CyberPanel packs everything you need to run a good WordPress website. To me, the most important features are one-click WordPress installs, easy to configure firewall, a lot of PHP versions to choose from, and Immunify AV + / Immunify 360 support. If you are going to host a lot of websites, CyberPanel supports conversion to CloudLinux for additional isolation and security of customer websites.

Although CyberPanel doesn’t officially support AlmaLinux or RockyLinux yet, the installer can be easily edited to allow this and the installation will proceed with no problem.

Link to the official website: https://cyberpanel.net/

2. LiteSpeed Enterprise vs OpenLiteSpeed​

The difference between the two servers is that LiteSpeed Enterprise supports .htaccess files. OpenLiteSpeed has partial support for rewriting rules. So far, in 3 years of experience designing WordPress websites, I haven’t missed the .htaccess support much.

3. Convert your images to WebP​

I can’t stress this enough. WebP can reduce the size of a page many, many times by compressing images in the newest format – Google WebP. There is no reason not to use WebP. Over 94% of modern browsers support it.

Advertisements

Use https://tinypng.com/

4. Use Cloudflare for CDN caching​

Cloudflare will cache your website and allow for insanely fast loading speeds from all points of the world. For Cloudflare’s cache to work properly, set up LiteSpeed Cache to “Remove Query Strings” from static resources. If a resource has a query string like script.js?v=1.0.0.123, Cloudflare won’t cache it.

5. Use the latest PHP​

PHP 8.0 gives an 18% performance boost over PHP 7.4, so unless you have a good reason to stay on PHP 7.4, go ahead and upgrade yourself.

6. Required plugins​

** WP Rocket –WordPress Best caching plugin:  WP Rocket is a premium cache plugin for WordPress. WordPress experts recognize it as the most powerful caching tool. Thanks to its wide range of options and automatic optimization features, it can be easily used by experienced WordPress users as well as beginners.

a. LiteSpeed cache for server-level caching. After you install it, get a QUIC.CLOUD domain key and account. The free optimizations QUIC.CLOUD gives to its customers is more than worth the hassle. Beware that these optimizations may break your website, so be careful what options you are enabling. Turn them on one by one, so if your site breaks, you will know what broke it.

b. WP Cloudflare Super Page Cache for Cloudflare caching. This plugin will allow you to use Cloudflare’s full caching functionality, massively increasing the percentage of your website that is cached by Cloudflare. Remember to enable the option to “Strip Response Cookies from Pages that Should be Cached”. If a page returns cookies, Cloudflare won’t cache it. Enable the Preloader and set it to preload all pages from your primary menu. Beware that if you set it up to preload all local links in the viewport, it will generate cookies, which you need to include in your GDPR policy.

c. WebP express for generation of WebP images. Personally, I don’t like LiteSpeed Cache’s way of generating WebP. Sometimes it will break the website. In order to use WebP Express, you need to install cwebp on your server. Luckily, it’s available on both Ubuntu Server and CentOS – like Linux. Installation is as easy as # apt install cwebp -y. The benefit is that you will be using our own VPS resources to generate WebP images, instead of paying an external service to do it.

7. Optional software​

You may consider Google’s ModPageSpeed, although this is advanced stuff and I am not going to cover it here. In my experience, ModPageSpeed is too hard to use and LiteSpeed Cache does a better job. ModPageSpeed is a server-level addon. You can’t enable it for individual websites only, so if you are hosting 100 customer websites and you install ModPageSpeed, 100 customer websites will break at the same time. But yes, ModPageSpeed will bump your GTMetrix / Google PageSpeed score by a lot, especially if you are using a slow theme and you are hosting a single website on the server.

8. Enable Memcached and Redis in LiteSpeed Cache.​

Object caching will speed your website up a lot.

9. Set up browsing caching rules in LiteSpeed Cache​

Browser caching rules will make subsequent visits to your site a lot faster for your visitors. Even if you are using OpenLiteSpeed, you can follow the guide on LiteSpeed’s website to enable browser caching rules.

10. Setup the Crawler​

LiteSpeed Cache will generate a cache for a given page when it’s visited for the first time. So, your first website visitor will get a slow website. The solution to this is to enable LiteSpeed Cache’s Crawler. The Crawler will crawl your website, prompting the server to cache all your pages without the need for human visitors to open them first. Just give the Crawler your sitemap and it will proceed to crawl your website and force the server to generate a proper cache.

I hope this was useful.

 

The #1 WordPress Speed Optimization Service. Speed Up Your Website For More Sales, Leads & SEO.

I’m doing a speed optimization service. Click for more details

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

My Orders

My Downloads

My Booked Services

My Subscriptions