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:common_installation:cpanel-shared [2017/05/11 21:01]
Michael Alegre [Web Cache Web Server Configuration - cPanel/WHM Multi-Site/Shared Hosting]
litespeed_wiki:cache:common_installation:cpanel-shared [2021/10/06 15:20] (current)
Lisa Clarke Redirect to new Documentation Site
Line 1: Line 1:
-====== Web Cache Web Server Configuration - cPanel/WHM Multi-Site/​Shared Hosting ====== +~~REDIRECT>​https://docs.litespeedtech.com/​cp/cpanel/lscache/~~
-This guide assumes that you have command-line access to the WHM Server. If you do not have command-line access, please refer to cPanel'​s documentation on [[https://documentation.cpanel.net/​display/​EA/​Advanced+Apache+Configuration#​AdvancedApacheConfiguration-ModifyyourglobalApacheconfiguration|editing Apache configuration files]] through the WHM GUI. +
- +
-Simply run the following script, which will set server level and virtual host level cache roots and cache policies: +
- +
-  bash <(curl https://www.litespeedtech.com/​packages/lscache/​set_cache_root_policy.sh) +
- +
-Note that this script doesn'​t enable cache lookup for users, you can either use the LiteSpeed WordPress Cache Management tools in the LiteSpeed WHM Plugin to manage this in bulk (the management tools will add the ''​CacheLookup''​ directive to the related .htaccess files), or add the ''​CacheLookup''​ directive to ''​.htaccess''​ files for individual users manually. This can be done by either the server administrator or the user themselves by adding the following lines: +
-  <​IfModule LiteSpeed>​ +
-    CacheLookup public on +
-  </​IfModule>​ +
- +
-//**Note:** The steps that follow will guide you through manually setting cache root and cache policy settings. If the above script has already been run, there is no need to follow these steps.// +
-===== Cache Storage Settings ===== +
-==== Set Server level cache root ==== +
-Add the following lines to the ''/​usr/​local/​apache/​conf/​includes/​pre_main_global.conf''​ file for EA3 or the ''/​etc/​apache2/​conf.d/​includes/​pre_main_global.conf''​ file for EA4 +
- +
-  <​IfModule Litespeed>​ +
-  CacheRoot /home/lscache/ +
-  </​IfModule>​ +
-   +
-**Note:** It is recommended that you set the server level cache root to ''/​home/​lscache/''​ or a disk partition with enough space. +
- +
-==== Set Virtual Host level cache root for all Virtual Hosts ====  +
-Create a ''​lscache_vhosts.conf''​ file in the ''/​usr/​local/​apache/​conf/​userdata/''​ directory for EA3 and the ''/​etc/​apache2/​conf.d/​userdata/''​ directory for EA4 (if these directories do not exist, create them). Your ''​lscache_vhosts.conf''​ file should contain the following lines: +
- +
-<​code>​ +
-<​IfModule Litespeed>​ +
-  CacheRoot lscache +
-</​IfModule>​ +
-</​code>​ +
- +
-This is done to set each Virtual Hosts' cache directory to its home directory (''/​home/<​user>/​lscache''​). +
- +
-Apply these changes to all Virtual Hosts by running the following command:  +
- +
-<​code>​ +
-/​scripts/​ensure_vhost_includes --all-users +
-</​code>​ +
- +
- +
- +
-//**Note**: You only need to run this command once and it will activate for all users, including new users created by WHM later. There is no need to edit the cPanel skeleton file.// +
- +
-==== Set Virtual Host level cache root for a single VHost ==== +
-**Example:​** Apache 2.2 installations with an HTTP site +
- +
-Create a file named ''​lscache_vhost.conf''​ in the ''/​usr/​local/​apache/​conf/​userdata/​std/​2_2/<​user>/<​domain>/''​ directory for EA3 or ''/​etc/​apache2/​conf.d/​userdata/​a/​std/​2_2/<​user>/<​domain>/''​ directory for EA4 (if this directory does not exist, create it) with the following lines: +
- +
-<​code>​ +
-<​IfModule Litespeed>​ +
-CacheRoot lscache +
-</​IfModule>​ +
-</​code>​ +
- +
-This will set the cache directory for this Virtual Host to /​home/<​user>/​lscache. +
- +
-Apply these changes to this Virtual Host by running the ''​ensure_vhost_includes''​ script with the following flag: +
- +
-<​code>​ +
-/​scripts/​ensure_vhost_includes --user=$user +
-</​code>​ +
- +
-For HTTPS sites or Apache 2.4 installations,​ please refer to cPanel'​s documentation on [[https://​documentation.cpanel.net/​display/​EA/​Modify+Virtualhost+Containers+With+Include+Files|modifying virtual host containers with include files]]. +
- +
-//**Note:** If different vhosts share the same document root, these vhosts have to share the same vhost level cache root directory.//​ +
- +
-===== Cache Policy Settings =====  +
- +
-The default LiteSpeed Cache settings work well with most caching scenarios. If you're configuring a shared hosting environment,​ don't change any of the **Server Level** default cache policy settings. Leave them as ''​Not Set''​ as below: +
-  Cache Policy: +
-  Enable Public Cache: Not Set +
-  Check Public Cache: Not Set +
-  Max Object Size: Not Set +
-  Cache Expire Time (seconds): Not Set +
-  Cache Stale Age (seconds): Not Set +
-  Cache Request with Query String: Not Set +
-  Cache Request with Cookie: Not Set +
-  Cache Response with Cookie: Not Set +
-  Ignore Request Cache-Control:​ Not Set +
-  Ignore Response Cache-Control:​ Not Set +
-  Enable Private Cache: Not Set +
-  Check Private Cache: Not Set +
-  Private Cache Expire Time (seconds): Not Set +
- +
-Add the following Apache-style configuration directive in your application level document root ''​.htaccess''​ file to enable cache lookup. +
- +
-<​code>​ +
-<​IfModule LiteSpeed>​ +
-  CacheLookup public on +
-</​IfModule>​ +
-</​code>​ +
- +
-//**Note:** If you are enabling LiteSpeed Cache through our [[litespeed_wiki:​cpanel:​whm-plugin-lscwp-management|WHM Plugin]], you may skip enabling cache lookup manually as the LiteSpeed Cache Management tool will add CacheLookup to .htaccess files for you.// +
- +
-===== Perform A Graceful Restart ===== +
-After applying your cache storage settings, perform a graceful restart of LiteSpeed Web Server to have these changes take effect. LiteSpeed Web Server will automatically create cache root directories with proper permissions. Users don't need to manually create any cache root directories themselves. +
- +
-<​code>​ +
-service lsws restart +
-</​code>​ +
- +
-===== Advanced Cache Configuration ===== +
-For Advanced Cache Configuration info, **[[litespeed_wiki:​cache:​common_installation:​advanced|look here]]**.+
  • Admin
  • Last modified: 2017/05/11 21:01
  • by Michael Alegre