Supercharge your Vanilla Community with LSCache!

Supercharge your Vanilla Community with LSCache!

Vanilla is a lightweight PHP based community forums. CyberPanel forums also run on Vanilla, it is already very good performance wise but with large communities and fewer server resources, you might want to make use of LiteSpeed cache to boost the performance of your Vanilla community.

Since LiteSpeed does not have an official plugin yet for Vanilla we can utilize rewrite rules to cache guest visitors of Vanilla, logged in users will not be cached using rewrite rules since they require more logic which can not be simply achieved via rewrite rules.

Step 1: Install CyberPanel and create your website!

Before we get started, you need to install CyberPanel and create your website.

Step 2: Download and install Vanilla Forums!

At the time of this writing, the latest version available to download from Vanilla is 2.5.1. Which you can download from here, you will get a file named ‘‘.  Upload this file to your website either using the File manager in CyberPanel or FTP. In this tutorial, we are going to leverage File manager.

Once a website is launched scroll down to find the File manager.

This will launch File manager, using which you can upload your vanilla forums zip file, make sure you have increased your upload limit to at least 12MB, because vanilla forum file size is ~10MB.

Once uploaded and unzipped, you can visit your domain to start the installation. Before that let’s create a database that vanilla is going to use.

Create Database!

From left sidebar click ‘Create Database’, select website from drop down so that you can create a database.

Start Installation!

To install Vanilla open your website URL where you have uploaded and unzipped vanilla, in this case, it is ‘’.

It is going to ask you your database details which you just created in last step and some other information which you can easily figure out. Once the installation is successful it will redirect you to vanilla administrator dashboard, and your main site should look something similar to:

Now let see how we can supercharge our vanilla forum using LSCache. 🙂

Step 3: Supercharge your site with LSCache!

This will be the most fun part of this article, will see how you can use rewrite rules to cache responses for logged out users.

So, after the installation is completed, I visited my site and noted down the state of cookies, here are the cookies when you are not logged into vanilla forums.

And once logged in I see some additional cookies:

Vanilla and Vanilla-Vv seem to be additional cookies once we are logged into the community. We can leverage one of these cookies to construct our rewrite rules. (Use rewrite rule guide to learn how you can add rewrite rules)

In rewrite rules above note “RewriteCond %{HTTP_COOKIE} !Vanilla-Vv [NC]”  which means that if “Vanilla-Vv” is not set in the request you can serve this request from the cache if a cached copy of this page is available.

If you want to go further and exclude some pages from being cached you can do that to, an example of these pages are login or dashboard pages, these are the pages which should not be usually cached.

Which means do not cache pages containing “dashboard” in the URL. So now your final rules should look like:

max-age takes time in seconds you want to cache the pages, you can change it to whatever you like. In this example, I set it to 120 seconds (2 minutes) after which page is going to be fetched from the backend.

Now on the command line you can see that you are getting X-Litespeed-Cache: hit

Which means the cache is working correctly.

Trouble shooting the cache!

There are probable chances that you might be getting cached responses even when you are logged in, the first thing you can do is to temporarily solve this issue by turning of cache lookup by removing “CacheLookup on” from rewrite rules.

In your test environment, you can see that what cookies are being set by Vanilla when you are logged in so that you can set them accordingly in rewrite rules.

reqCookieCache and respCookieCache

Note: Do this only if you are getting cache hits for logged in users too.

In your httpd_config.conf (which is normally located at /usr/local/lsws/conf/httpd_config.conf) you can find these two parameters and set them to 0

  • respCookieCache 0
  • reqCookieCache 0

You can read more about them here.


Let see how well OpenLiteSpeed performs against Nginx. I am going to use standard DigitalOcean droplet with following specs:

  • 1 GB Memory
  • 25 GB Disk
  • 1 vCPU.

OpenLiteSpeed Performance

Command used to perform benchmarks:

  • 1st Run: 4.010 Seconds.
  • 2nd Run: 3.834 Seconds.
  • Third Run: 3.822 Seconds.
  • 4th Run: 3.997 Seconds.
  • 5th Run: 3.935 Seconds.

Average = 3.9196 Seconds.

Nginx (Apache on Backend) Performance

Command used to perform benchmarks:

  • 1st Run: 479.182 Seconds.
  • 2nd Run: 389.429 Seconds.
  • Third Run: 408.600 Seconds.
  • 4th Run: 422.308 Seconds.
  • 5th Run: 594.049 Seconds.

Average = 458.7136 Seconds.

I had to set additional parameter -s 120 because without this parameter test was timing out on Nginx with apache backend.


It is too good to be true as we got average of 3.9196 Seconds on OpenLiteSpeed vs 458.7136 Seconds for Nginx (with apache as backend). But its true, you can spin a small VPS and run these tests.

Please note that there were no extra optimizations it was a clean install of CyberPanel. You just need to know how you can use rewrite rules to cache pages.


10 thoughts on “Supercharge your Vanilla Community with LSCache!

  1. Technically you’re still testing Apache’s processing of PHP if you have Nginx setup as a reverse proxy. What are the average benchmark run times for ? time taken for tests ? or average time per request ?

    Could you show the full output for ab benchmarks for both runs ?

    1. For some reason when I ran a test against pure Nginx results was even slower. These results are too good to be true, the point here is it was a clean install of CyberPanel with no other optimization tweaks and how easy it is to set up these rewrite rules.

      And even if you consider setting rewrite rules as for burden there are many LiteSpeed plugins that do not require setting up these rules and out of the box, you get this performance. It is actually the ease of you, that how easily you can get this performance. Because it was OpenLiteSpeed out of the Box vs Nginx (Apache backend). I am sure that even if you don’t cache, and let OpenLiteSpeed process PHP, OpenLiteSpeed still wins.

      And I ran these tests 5 times to be sure (and took the average). Since it is a blog comment, when I have time I will re-run the same test and produce output on CyberPanel forums.


  2. Yeah was curious so looking forward to your forum post. FYI here’s pure Nginx 1.13.10 + PHP-FPM 7.1.15 + MariaDB 10.1.31 CentOS 7.4 on 2GB OpenVZ 2cpu E5-1650v3 VPS

    fastcgi_cache + memcached

    ab -n 5000 -k -H “Accept-Encoding: gzip,deflate” -c 25

    Server Software: nginx
    Server Hostname:
    Server Port: 80

    Document Path: /
    Document Length: 2617 bytes

    Concurrency Level: 25
    Time taken for tests: 0.912 seconds
    Complete requests: 5000
    Failed requests: 0
    Write errors: 0
    Keep-Alive requests: 0
    Total transferred: 14785000 bytes
    HTML transferred: 13085000 bytes
    Requests per second: 5482.35 [#/sec] (mean)
    Time per request: 4.560 [ms] (mean)
    Time per request: 0.182 [ms] (mean, across all concurrent requests)
    Transfer rate: 15831.35 [Kbytes/sec] received

    1. On OpenVZ 2GB Ram and 2 Core VPS.

      Model name : Intel(R) Xeon(R) CPU X3440 @ 2.53GHz

      ab -n 5000 -k -H “Accept-Encoding: gzip,deflate” -c 25
      This is ApacheBench, Version 2.3
      Copyright 1996 Adam Twiss, Zeus Technology Ltd,
      Licensed to The Apache Software Foundation,

      Benchmarking (be patient)
      Completed 500 requests
      Completed 1000 requests
      Completed 1500 requests
      Completed 2000 requests
      Completed 2500 requests
      Completed 3000 requests
      Completed 3500 requests
      Completed 4000 requests
      Completed 4500 requests
      Completed 5000 requests
      Finished 5000 requests

      Server Software: LiteSpeed
      Server Hostname:
      Server Port: 80

      Document Path: /
      Document Length: 2516 bytes

      Concurrency Level: 25
      Time taken for tests: 0.348 seconds
      Complete requests: 5000
      Failed requests: 0
      Write errors: 0
      Keep-Alive requests: 5000
      Total transferred: 14175000 bytes
      HTML transferred: 12580000 bytes
      Requests per second: 14363.28 [#/sec] (mean)
      Time per request: 1.741 [ms] (mean)
      Time per request: 0.070 [ms] (mean, across all concurrent requests)
      Transfer rate: 39765.52 [Kbytes/sec] received

      Connection Times (ms)
      min mean[+/-sd] median max
      Connect: 0 0 0.1 0 1
      Processing: 0 2 2.3 2 24
      Waiting: 0 2 2.3 2 24
      Total: 1 2 2.3 2 24

      Percentage of the requests served within a certain time (ms)
      50% 2
      66% 2
      75% 2
      80% 2
      90% 2
      95% 2
      98% 2
      99% 20
      100% 24 (longest request)

  3. Very nice. so the above original blog average times are for time taken for test or time per request ? Just trying to get a bearing on what the blog results mean in terms of ab average times.

  4. Thanks for this awesome tutorial. My site is up and running. Just facing one small issue.

    Litespeed cache is not working. I am getting ” X-Litespeed-Cache: Miss”

    what to do?

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: