Table of Contents

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:

<IfModule Litespeed>
CacheEngine off
</IfModule>

To enable cache, esi and crawler:

<IfModule Litespeed>
CacheEngine on esi crawler
</IfModule>

To enable cache, but neither esi nor crawler:

<IfModule Litespeed>
CacheEngine on
</IfModule>

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 <IfModule Litespeed> .. </IfModule>, right after the CacheRoot configuration, like so:

<IfModule Litespeed>
CacheRoot /home/lscache/
CacheEngine off
</IfModule>

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/<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. Add the following lines:

<IfModule Litespeed>
CacheRoot lscache
CacheEngine on esi crawler
</IfModule>

This will set the cache directory for this Virtual Host to /home/<user>/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 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 How to enable crawler for WordPress . (Crawler support may be expanded to other applications when those LiteSpeed cache plugins become available.)