Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:cache:no-plugin-drupal [2018/03/21 13:25]
Jackson Zhang [LSCache + Drupal Configuration]
litespeed_wiki:cache:no-plugin-drupal [2020/12/08 17:13]
Lisa Clarke Fixed redirect link
Line 1: Line 1:
-====== LSCache + Drupal 6/7 Configuration ====== +~~REDIRECT>​https://​docs.litespeedtech.com/lscache/noplugin/settings/~~
- +
-**NOTE: [[litespeed_wiki:​cache:​lscdrupal|There is a module now]]. If you are running Drupal 8, please use the module. If you are running Drupal 6 or 7, you can still use the rewrite rule based lscache as instructed in this wiki ** +
- +
-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 Drupal, you can expect significant performance gains and a quick and easy setup. Cache management is also made significantly easier and more flexible with the ability to use rewrite rules to customize cache behavior. +
- +
-Below are some recommended configurations to enable LSCache and get it working with your Drupal site(s). +
- +
-===== Configure Server/​Virtual-Host-Level Cache Root And Cache Policy ===== +
- +
-Server/​Virtual-Host-level cache storage needs to be configured properly for your environment. Select your server setup from the **Web Server Configuration** section of our [[litespeed_wiki:​cache:​common_installation#​web_server_configuration|LiteSpeed Cache Installation Guide]] and follow the instructions to set the server/​virtual-host-level cache root and cache policy. +
- +
-===== Rewrite rules ===== +
- +
-At the ''​.htaccess''​ file in the document root of your website after:  +
-  # Various rewrite rules. +
-  <​IfModule mod_rewrite.c>​ +
- +
-Add the following rewrite rules: +
- +
-  ########## Begin - Litespeed cache +
-  <​IfModule LiteSpeed>​ +
-    CacheDisable public / +
-    RewriteEngine On   +
-    RewriteCond %{REQUEST_METHOD} ^GET|HEAD|PURGE$ +
-    RewriteCond %{HTTP_HOST} ^(www.)?​your_domain_name.com [NC] +
-    RewriteCond %{REQUEST_URI} !admin|register|login [NC] +
-    RewriteCond %{HTTP_COOKIE} !SESS [NC] +
-    RewriteCond %{QUERY_STRING} !nocache +
-    RewriteRule .* - [E=Cache-Control:​max-age=120] +
-  </​IfModule>​ +
-  ########## End - Litespeed cache +
-   +
-====Notes==== +
- +
-  * The ''​CacheDisable public /''​ directive is used to help protect against globally-enabled caching and is optional. If this directive is not used, the server'​s global cache settings should be checked to ensure that cache is not enabled globally. **Do NOT** use ''​CacheEnable public /''​ here as it will enable caching for all URLs belonging to this virtual host, including admin pages. +
-  * ''​your_domain_name.com''​ is the web address of your Drupal site.   +
-  * We recommend using a different domain for your backend so that you can add/​edit/​preview a website'​s content through the admin domain without worrying about these changes being cached and seen by visitors. +
-  * To get the non-cached version of a page, add the ''?​nocache''​ query string to a URL. +
- +
-For example: +
- +
-<code> +
-https://www.your_domain_name.com/about?​nocache  +
-https://www.your_domain_name.com/about?​some_other_query_string&​nocache +
-</​code>​ +
-===== Verify Cache Setup ===== +
- +
-Look for ''​X-LiteSpeed-Cache:​ hit''​ in the reply headers as shown below. [[litespeed_wiki:​cache:​no-plugin-setup-guidline#​verify_that_pages_are_served_from_the_cache|See more detailed directions here]]. FYI, ''​X-Drupal-Cache:​ HIT''​ and ''​X-Drupal-Dynamic-Cache:​ MISS''​ are drupal internal page cache headers and are not related to LiteSpeed cache. +
- +
-{{ :​litespeed_wiki:​cache:​drupal-cache-header.png?​800 |}} +
-===== Deleting Outdated Cache Files Using A Cron Job ===== +
- +
-Please refer to [[litespeed_wiki:​cache:​no-plugin-setup-guidline#​deleting_outdated_cache_files_using_a_cron_job|this wiki]] to learn how to clean up outdated cache files.+
  • Admin
  • Last modified: 2020/12/08 17:13
  • by Lisa Clarke