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
Last revision Both sides next revision
litespeed_wiki:cache:lscxf2 [2018/03/09 22:33]
Michael Alegre [Installation]
litespeed_wiki:cache:lscxf2 [2020/02/27 16:33]
Michael Alegre [Configuration] Added missing style and language varys to .htaccess caching rules.
Line 1: Line 1:
 ====== LSCache Plugin for XenForo 2 ====== ====== LSCache Plugin for XenForo 2 ======
  
-===== Features ===== +This guide is intended for XenForo 2.x usersFor XenForo 1.x installation instructions [[litespeed_wiki:​cache:​lscxf:​installation|click here]].
- +
-  * Powerful defense against DDOS attacks. +
-  * Significantly reduce server load (and MySQL queries). +
-  * Guests pages are cached by LiteSpeed ​cache.+
  
 ===== Installation ===== ===== Installation =====
  
-  - [[https://​xenforo.com/​community/​resources/​litespeed-cache-for-xf2-community.6248/​|Download ​LSCXF2]]+  - [[https://​xenforo.com/​community/​resources/​litespeed-cache-for-xf2-community.6248/​|Download ​the LiteSpeed Cache for XenForo  
 + ​plugin package]].
   - Disable any other page caches as these will interfere with LSCXF2.   - Disable any other page caches as these will interfere with LSCXF2.
   - Access the server hosting your XenForo installation,​ either directly or using ssh/sftp.   - Access the server hosting your XenForo installation,​ either directly or using ssh/sftp.
-  - From the unzipped LSCXF2 folder, copy all files under upload to the upload folder ​of your XenForo installation.+  - From the unzipped LSCXF2 folder, copy all files under ''​upload'' ​to the root directory ​of your XenForo ​installation.
   - In the XenForo control panel, navigate to the Add-ons section to complete the installation.   - In the XenForo control panel, navigate to the Add-ons section to complete the installation.
  
 ===== Configuration ===== ===== Configuration =====
  
-Edit ''​.htaccess'' ​with the code shown below, making the following changes where appropriate:​ +Once you have downloaded and installed the plugin package, edit the ''​.htaccess'' ​file in the XenForo root directory and add the code shown below to the top, making the following changes where appropriate:​ 
-  * Replace ​''​xf_user''​ with the new valueif you changed ​it in XenForo ​Configuration+  * The default cookie prefix set for XenForo is ''​xf_''​, so all cookies set by xenForo will begin with this prefix (''​xf_user''​''​xf_session_admin'',​ etc). If you have changed ​the cookie prefix ​in the XenForo ​configuration file, please make sure to update all ''​xf_COOKIE_NAME''​ cookies in the rewrite rules below to use the correct prefix. For example, if your set cookie prefix is ''​myXF_''​ you would update ''​xf_user''​ to ''​myXF_user''​ and so on
   * If you want to cache for more or less than 360 seconds, change ''​360''​ to the number of seconds you wish. (Recommended < 10 minutes):   * If you want to cache for more or less than 360 seconds, change ''​360''​ to the number of seconds you wish. (Recommended < 10 minutes):
 +  * **Note:** Ensure that this code is added before any rewrite rules containing the ''​[L]''​ flag which could stop ''​.htaccess''​ processing and prevent the code from being executed.
  
-  ​# LiteSpeed XenForo cache +<​code>​ 
-  <​IfModule litespeed>​ +# LiteSpeed XenForo cache 
-      CacheLookup public on +<​IfModule litespeed>​ 
-      RewriteEngine On +    CacheLookup public on 
-       ​# cache +    RewriteEngine On 
-       ​RewriteCond %{HTTP_COOKIE} !xf_user [NC] +    # cache 
-       ​RewriteRule .* - [E=Cache-Control:​max-age=360] +    RewriteCond %{HTTP_COOKIE} !(xf_lscxf_logged_in|xf_user|xf_session_admin) ​[NC] 
-       ​# no cache +    ​RewriteCond %{REQUEST_URI} !/install/ [NC] 
-       ​RewriteCond %{HTTP_COOKIE} xf_user [NC] +    ​RewriteRule .* - [E=Cache-Control:​max-age=360,​E="​cache-vary:​xf_style_id,​xf_language_id"​
-       ​RewriteRule .* - [E=Cache-Control:​no-cache] +    # no cache 
-  </​IfModule>​ +    RewriteCond %{HTTP_COOKIE} ​(xf_lscxf_logged_in|xf_user|xf_session_admin) ​[NC] 
 +    RewriteRule .* - [E=Cache-Control:​vary=loggedin,​E=Cache-Control:​no-cache] 
 +</​IfModule>​ 
 +</​code>​
 ===== Notes ===== ===== Notes =====
  
-  * LSCXF2 is rewrite-rule based. There is currently no tag-based purge available (though, we are working on it for the future). Because of this, it is recommended that you use a small TTL (less than 10 minutes, or 600 seconds). A small TTL minimizes the chances of serving stale content.+  * TTL in LSCXF2 is currently controlled by rewrite ​rules. There is currently no tag-based purge available (though, we are working on it for the future). Because of this, it is recommended that you use a small TTL (less than 10 minutes, or 600 seconds). A small TTL minimizes the chances of serving stale content.
   * Only non-logged-in users are served from cache.   * Only non-logged-in users are served from cache.
   * LSCXF2 is developed specifically for XenForo 2.x. If you are running a XenForo 1.x forum, please use [[litespeed_wiki:​cache:​lscxf#​lscxf_for_xenforo_1x|LSCache for XenForo 1]].   * LSCXF2 is developed specifically for XenForo 2.x. If you are running a XenForo 1.x forum, please use [[litespeed_wiki:​cache:​lscxf#​lscxf_for_xenforo_1x|LSCache for XenForo 1]].
  
  • Admin
  • Last modified: 2020/08/05 16:33
  • by Lisa Clarke