How do I configure LiteSpeed cache for WordPress?

Recently Updated

Question: How to set up litespeed cache for my wordpress website ;

Concerns : WebHosting | Linux Plesk Reseller Hosting


Hosting Settings: Run PHP As

The litespeed webserver is only supported on node1 & node2 webservers for reseller & shared hosting services.

Before we start anything, we need to make sure that the php handler setting is FastCGI and not FPM.

Litespeed webserver only supports FastCGI.

After logging into the plesk panel, we find the hosting settings of the domain.

In the field that mentions run PHP as, we select FastCGI, if it's not already selected.

WP Litespeed Installation

  • Through the wordpress management, we open the plugins page.

  • We click on add new plugin and search for litespeed cache

  • We select install and activate the litespeed cache plugin.

Caching Plugin Settings

We will see in the wordpress left menu that a new entry has been created called Litespeed Cache.

We open the settings and select to open the toolbox

With the toolbox, we can import pre-made caching settings that we have already created for you.

Download from the following page the settings file for import

You can download the Basic profile cache for the most secure settings.

Basic Cache Profile

After downloading the file, we find it on our computer and select "Import"

Enable Cloud Functions

To be able to use the cloud functions of the cache, we need an api key that we ask very easily from the General/Γενικά option

After a few minutes, the key will be enabled and we can apply the cloud functions.

Litespeed cloud functions can:

  • Convert images to .webp
  • Create optimized css and javascript files
  • and many more.

Image Conversion to .webp

From the litespeed menu, we select Image optimization

We click on "Gather Image Data"

Automatically, a automated process will be created to convert all images to .webp

Litespeed Crawler

The crawler is a function of the litespeed webserver that creates the cached version of our website before users visit it.

The crawler is essentially a visitor before the visitor, which passes over our website, creates and always keeps "fresh" the cached version of our page.

When the real visitor comes, the webserver does not need to create cache content for the visitor. It has already created it for the crawler.

To function, the crawler needs the sitemap of our website.

Usually, it is in the form of domain.gr/sitemap.xml

We take the sitemap url of our website and save it in the field Litespeed -> crawler -> sitemap settings -> Custom Sitemap.

After saving, we go to the 2nd tab and click on "Refresh crawler map". Immediately, we will see that all the urls of our website will be displayed.

In the 4th tab "General Settings", we select Crawler = ON and in the last option Server Load Limit = 3

After these settings, the crawler will automatically create cache with fresh content.

Redis Object Cache

Our service supports the object caching function through the Redis Service.

What is object cache?

Object cache stores queries that the database executes and, when enabled on your WordPress site, can help speed up PHP execution times, reduce database load, and provide content to your visitors faster.

Instead of loading each part of a website every time a user accesses it, object caching stores database queries that can retrieve content faster when needed.

To enable it through litespeed cache, we select Litespeed cache -> cache -> Object

We select

  • Object Cache = ON
  • Method: Redis
  • Host: localhost
  • Port: 6379

For all the rest, we leave the default settings and click Save