LiteSpeed Web Server -Quick intro to built-in cache


LiteSpeed is a proprietary alternative to the more popular Apache Web Server.

The Good

  1. Drop in replacement for Apache –  this means uninstall apache, install litespeed, it supports all apache extensions out of the box.
  2. Minimal memory and CPU consumption.
  3. Built in anti-DDoS features.
  4. Built in cache and performance optimizations
  5. Has an open-source alternative – OpenLiteSpeed
  6. Supports TLS 1.3

The Bad

  1. Commercial/Proprietary


Having worked mostly with Nginx and Apache servers, I must admit that LiteSpeed has impressive features. The ease of deployment of servers, while still using your old Apache config files and support of apache extensions out of the box is one of its high notes.


Caching support out of the box. With a simple configuration.

By adding this code at the very top of your .htaccess

<IfModule LiteSpeed>
    CacheEnable public
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} ^GET|HEAD$
    RewriteCond %{HTTP_HOST} ^ [NC]
    RewriteCond %{REQUEST_URI} !login|admin|register|post|cron
    RewriteCond %{QUERY_STRING} !nocache
    RewriteRule .* - [E=Cache-Control:max-age=300]

You instantly enable the inbuilt caching.

Testing cache

To check if caching is working correctly, reload your website using CTRL+F5 (To clear browser cache)

Load up Chrome DevTools (F12), go to the “Network” tab and check the headers for the website.

litespeed cache headers

The headers will contain: x-litespeed-cache and will be a ‘hit’ if the cache is being used for that particular resource.




Facebook Comments