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 [2016/08/26 12:48]
Jackson Zhang
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 http://www.litespeedtech.com/​packages/lscache/​set_cache_root_policy.sh) +
- +
-Please bear in mind that the script doesn'​t enable the cache lookup for user, you can either use LiteSpeed WP Cache management tools to manage it in bulk (Management tool will add CacheLookup directive to related .htaccess files) , or add cache lookup directive to .htaccess for any particular user manually by either server administrator or user himself. +
-  <​IfModule LiteSpeed>​ +
-    CacheLookup public on +
-  </​IfModule>​ +
- +
-The following wiki explain steps in details to set cache root and cache policy manually, though there is no such need if the above script has been run already. +
-===== Cache Storage Settings ===== +
-==== Set Server level cache root ==== +
-Add the following content to ''/​usr/​local/​apache/​conf/​includes/​pre_main_global.conf''​ for EA3 or ''/​etc/​apache2/​conf.d/​includes/​pre_main_global.conf''​ 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. Server level cache root will only be used when a vhosts cache root is not set. +
- +
- +
-==== Set Virtual Host level cache root for all VHosts ====  +
-Create a file named ''​lscache_vhosts.conf''​ in the ''/​usr/​local/​apache/​conf/​userdata/''​ for EA3 and ''/​etc/​apache2/​conf.d/​userdata/''​ for EA4 (if this directory does not exist, create it) with the following content: +
- +
-<​code>​ +
-<​IfModule Litespeed>​ +
-  CacheRoot lscache +
-</​IfModule>​ +
-</​code>​ +
- +
-This is done to set cache directory for all Virtual Hosts in their 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. 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 contents: +
- +
-<​code>​ +
-<​IfModule Litespeed>​ +
-CacheRoot ​lscache +
-</IfModule>​ +
-</​code>​ +
- +
-This is done to 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 command: +
- +
-<​code>​ +
-/​scripts/​ensure_vhost_includes --user=$user +
-</​code>​ +
- +
-For HTTPS sites or Apache 2.4 installations,​ please refer to cPanels 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''​. +
-  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 ''​.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 this step since LSCache Management tool will add CacheLookup to .htaccess 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 permission. 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: 2016/08/26 12:48
  • by Jackson Zhang