====== Enabling Cache/ESI/Crawler for an Individual Virtual Host ======
A shared hosting provider may want to maintain server-wide control over the enabling and disabling of cache-related services. These services include caching itself as well as the ESI and Crawler functions available with our WordPress LSCache Plugin. By disabling the cache globally and enabling it for a particular virtual host, shared hosting providers may offer LSCache as an add-on service to their customers.
''esi'' and ''crawler'' are disabled by default during the initial installation and you will need to enable them specifically.
===== CacheEngine on/off directives =====
Use the following directives to disable cache on a global level, such as with cPanel's ''pre_main_global'', and enable it individually in a virtual host include file ( but not ''.htaccess'').
To disable cache:
CacheEngine off
To enable cache, esi and crawler:
CacheEngine on esi crawler
To enable cache, but neither esi nor crawler:
CacheEngine on
===== Examples: cPanel =====
To disable cache globally, add the directive 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. It should be placed within '' .. '', right after the CacheRoot configuration, like so:
CacheRoot /home/lscache/
CacheEngine off
To enable it for a particular virtual host (in this example, Apache 2.2 installation with an HTTP site), create a file named ''lscache_vhost.conf'' in the ''/usr/local/apache/conf/userdata/std/2_2///'' directory for EA3 or ''/etc/apache2/conf.d/userdata/a/std/2_2///'' directory for EA4. If this directory does not exist, create it. Add the following lines:
CacheRoot lscache
CacheEngine on esi crawler
This will set the cache directory for this Virtual Host to ''/home//lscache''.
Apply the changes to this Virtual Host by running the ''ensure_vhost_includes'' script with the following flag:
/scripts/ensure_vhost_includes --user=$user
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]].
===== Other control panels =====
If you use other control panels, you should be able to adapt the above instructions in order to control the cache for your shared hosting accounts.
===== Enabling the WordPress Crawler =====
For details on how to enable the crawler for WordPress, pleaser refer to [[litespeed_wiki:cache:lscwp:configuration:enabling_the_crawler|How to enable crawler for WordPress ]]. (Crawler support may be expanded to other applications when those LiteSpeed cache plugins become available.)