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:common_installation:cpanel-shared [2018/02/05 17:19]
Lisa Clarke Proofreading and streamlining
litespeed_wiki:cache:common_installation:cpanel-shared [2019/04/22 17:32]
Michael Alegre Shortened WHM plugin section to link to the appropriate page.
Line 8: Line 8:
   * Manually from the Command Line   * Manually from the Command Line
  
-===== Setting Cache Root via WHM Plugin ===== +===== Setting Cache Roots via WHM Plugin ===== 
-The preferred way to set up the cache root is through the WHM plugin.+The preferred way to set up the needed ​cache roots is through the WHM plugin. Detailed steps on how to do this can be found [[litespeed_wiki:​cpanel:​whm-plugin-lscwp-management#​cache_root_setup|here]].
  
-{{:​litespeed_wiki:​cpanel:​screen_shot_2016-09-29_at_10.45.06_am.png?​nolink|}} +===== Setting ​Cache Roots and Policies from a Command Line Script =====
- +
-==== Server Level ==== +
- +
-This screen searches for server-level cache root definitions in either the ''/​usr/​local/​apache/​conf/​includes/​pre_main_global.conf''​ file or in the LiteSpeed Web Server Web Admin **Storage Path** setting found under **Server > Cache > Cache Storage Settings**. +
- +
-If it is defined in ''​pre_main_global.conf''​ it should look something like this: +
- +
-  <​IfModule LiteSpeed>​ +
-  CacheRoot /​home/​lscache/​ +
-  </​IfModule>​ +
- +
-In this example, the server-level cache root is set to ''/​home/​lscache/''​ +
- +
-==== VHost Level ==== +
-Additionally,​ this screen searches for virtual-host-level cache root definitions in the ''/​usr/​local/​apache/​conf/​userdata/​lscache_vhosts.conf''​ file. +
- +
-If it is defined in ''​lscache_vhosts.conf''​ it should look something like this: +
- +
-  <​IfModule LiteSpeed>​ +
-  CacheRoot lscache +
-  </​IfModule>​ +
-   +
-In this example, the vhost-level cache root will be set to ''/​home/<​user_folder>/​lscache''​ +
- +
-==== Set Missing ​Cache Roots ==== +
-The **Set Missing Cache Roots** button sets server-level and vhost-level cache root definitions if they are detected as not set. This button will only appear if at least one of the two cache roots (server level or vhost level) is detected as not set. +
- +
-===== Setting Cache Root and Policies from a Command Line Script =====+
 You may use the command line instead of the WHM plugin. Simply run the following script, which will set server level and virtual host level cache roots and cache policies: You may use the command line instead of the WHM plugin. Simply run the following script, which will set server level and virtual host level cache roots and cache policies:
  
Line 61: Line 33:
   </​IfModule>​   </​IfModule>​
  
-===== Setting Cache Root and Policies Manually from the Command Line =====+===== Setting Cache Roots and Policies Manually from the Command Line =====
 The steps that follow will guide you through manually setting cache root and cache policy settings. The steps that follow will guide you through manually setting cache root and cache policy settings.
  
Line 152: Line 124:
 ==== Advanced Cache Configuration ==== ==== Advanced Cache Configuration ====
 For Advanced Cache Configuration info, **[[litespeed_wiki:​cache:​common_installation:​advanced|look here]]**. For Advanced Cache Configuration info, **[[litespeed_wiki:​cache:​common_installation:​advanced|look here]]**.
 +
 +===== Setting Cache Roots to a Secondary Disk (with CageFS) =====
 +In some environments,​ you might run with normal hard drives for ''/​home'',​ but you want to place your ''​lscache''​ data on SSDs, such as ''/​ssdcache/​lscache''​. This requires a bit of special configuration both within your CacheRoot setting as well as CageFS.
 +
 +Make sure that your secondary disk is mounted on ''/​ssdcache''​ and that the directory ''​lscache''​ exists.
 +
 +Within ''/​etc/​apache2/​conf.d/​userdata/​lscache_vhosts.conf'',​ you'll have to add the following content:
 +
 +  <​IfModule Litespeed>​
 +  CacheRoot /​ssdcache/​lscache/​$vh_user
 +  </​IfModule>​
 +
 +The above 3 lines will tell LiteSpeed that the vhost-level cache corresponds to a dynamic LSCache folder which matches the user of the VirtualHost. This will ensure that the cache for each customer gets separated.
 +
 +If you're using CageFS, you also need to expose this within the caged environment. Luckily, it's rather easy to do!
 +
 +In your ''/​etc/​cagefs/​cagefs.mp''​ file, you can add the line:
 +
 +  %/​ssdcache/​lscache
 +
 +By using ''​%''​ in front of the path, it utilizes the "split by username"​ functionality added in CageFS 5.3.1, so what will be exposed within CageFS will be ''/​ssdcache/​lscache/​$user''​.
 +
 +To apply the above changes, we first rebuild the httpd configuration in cPanel and restart LiteSpeed:
 +
 +  /​scripts/​rebuildhttpdconf
 +  /​scripts/​restartsrv_httpd
 +
 +Afterwards, we have to remount CageFS for all users, so the new path becomes available within CageFS:
 +
 +  cagefsctl --remount-all
 +
 +Your LSCache data will now be stored on the SSD instead of your hard drive!
  • Admin
  • Last modified: 2021/10/06 15:20
  • by Lisa Clarke