This is an old revision of the document!


LSCache + Concrete5

LSCache, similar to Varnish cache, is a simpler and more efficient page caching solution built-in to LiteSpeed Web Server. When used in conjunction with Concrete5, you can expect significant performance gains with a quick and easy setup. Cache management is also made significantly easier and more flexible.

Below are some recommended configurations to enable LSCache and get it working with your Concrete5 installation.

Server/VirtualHost level cache storage needs to be configured properly for your environment. Select your server setup from the Web Server Configuration section of our LiteSpeed Cache Installation Guide and follow the instructions to set the server/virtual host level cache root and cache policy.

Install Concrete5 on a domain or a subdomain, and then create a new admin subdomain. Both domains must use the same document root.

Why?

Caching a Concrete5 site can be tricky, because there is no admin directory. As such, when you cache the site for visitors, you are also caching it for admin functions and development. This is not ideal.

One solution is to define a subdomain that you can use when you want to do administrative tasks. Configure the subdomain to use the same document root as the main site's domain (i.e. public_html), and then exclude it from caching in .htaccess. This essentially gives you two different ways of accessing the exact same site. To view the cached content, you would access the site at www.domain.com, and to do admin work, you would access the uncached content at admin.domain.com. They point to the same location, except one is cached and one is not.

For more about this concept, please see the blog post by madesimplemedia.

Activate cache for the main domain with:

RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{HTTP_HOST} ^domain.com [NC] [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule .* - [E=Cache-Control:max-age=120]

After that, exclude the subdomain that we will use for administration with:

RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{HTTP_HOST} ^admin.domain.com$ [NC]
RewriteRule .* - [E=Cache-Control:no-cache]

Please make sure you can see the X-LiteSpeed-Cache: hit header by following this wiki. Note that you will see a cache hit only for the main domain as the admin subdomain is excluded.

Please refer to this wiki.

  • Because of the way you set up the main domain and admin domain, it is better for SEO if you disable Google and other robots from indexing the admin domain. Otherwise, your SEO will be penalized because of duplicate content.
  • If you have problems accessing the subdomain, please check the code in your .htaccess file.
  • Admin
  • Last modified: 2018/07/11 14:29
  • by Lisa Clarke