This guide assumes that you have command-line access to the Plesk Server in question. If you do not have command-line access, please refer to Plesk's documentation on editing Apache configuration files through the Plesk 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 add cache lookup directive to .htaccess for any particular user manually. Out WordPress Cache Management tool for Plesk can manage the bulk enabling and disabling as you want and it is currently under development.
<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.
Create a file named lscache.conf
in the following directory depending upon your system:
/etc/httpd/conf.d/
directory/etc/apache2/conf.d/
directory/etc/apache2/conf-enabled
directory
This lscache.conf
file should contain the following:
<IfModule Litespeed> CacheRoot /var/www/vhosts/lscache/ </IfModule>
Note: It is recommended that you set the server level Cache Root to /var/www/vhosts/lscache/
or a disk partition with enough space.
Create the /usr/local/psa/admin/conf/templates/custom/domain
directory if it does not already exist. Copy domainVirtualHost.php
to this location and view its contents.
cd /usr/local/psa/admin/conf/templates/ mkdir -p custom/domain cp default/domain/domainVirtualHost.php custom/domain/. vi /usr/local/psa/admin/conf/templates/custom/domain/domainVirtualHost.php
Add the following lines to the proper location in domainVirtualHost.php
(we recommend inserting after the mod_suexec.c
block):
<IfModule LiteSpeed> CacheRoot lscache </IfModule>
This is done to set the cache directory for each vhost in each user's home directory (such as /var/www/vhosts/<domain_name>/lscache
).
Reconfigure all virtual hosts (this will regenerate new configuration files for all vhosts).
/usr/local/psa/admin/bin/httpdmng --reconfigure-all
For more information on this, please refer to Plesk's documentation on Changing Virtual Host Settings Using Configuration Templates.
Create a file called vhost.conf
if it does not already exist ( or vhost_ssl.conf
for HTTPS sites) with the following content in the /var/www/vhosts/system/<domain_name>/conf/
directory:
<IfModule Litespeed> CacheRoot lscache </IfModule>
This is to set the cache directory for this vhost in its home directory (such as /var/www/vhosts/<domain_name>/lscache
).
Reconfigure this Virtual Host (this will regenerate new configuration files for this vhost).
/usr/local/psa/admin/bin/httpdmng --reconfigure-domain <domain_name>
After applying the above cache storage settings, perform a graceful restart of LiteSpeed Web Server to have these changes take effect. LiteSpeed Web Server will automatically create the cache root directory with proper permission. Users don't need to manually create any cache root directories themselves.
service lsws restart
LiteSpeed Cache default 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.
<IfModule LiteSpeed> CacheLookup public on </IfModule>
For Advanced Cache Configuration info, look here.