====== Web Cache Web Server Configuration - Plesk Multi-Site/Shared Hosting ======
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 [[http://docs.plesk.com/en-US/12.5/advanced-administration-guide-linux/virtual-hosts-configuration/virtual-hosts-and-hosting-types/virtual-host-configuration-files.72064/ |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.
CacheLookup public on
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 ====
Create a file named ''lscache.conf'' in the following directory depending upon your system:
* For CentOS, the ''/etc/httpd/conf.d/'' directory
* For Debian, the ''/etc/apache2/conf.d/'' directory
* For Ubuntu, the ''/etc/apache2/conf-enabled'' directory
This ''lscache.conf'' file should contain the following:
CacheRoot /var/www/vhosts/lscache/
**Note:** It is recommended that you set the server level **Cache Root** to ''/var/www/vhosts/lscache/'' or a disk partition with enough space.
==== Set Virtual Host level cache root for all VHosts====
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):
CacheRoot lscache
This is done to set the cache directory for each vhost in each user's home directory (such as ''/var/www/vhosts//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 [[http://docs.plesk.com/en-US/12.5/advanced-administration-guide-linux/virtual-hosts-configuration/changing-virtual-hosts-settings-using-configuration-templates.68693/|Changing Virtual Host Settings Using Configuration Templates]].
==== Set Virtual Host level cache root for a single VHost ====
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//conf/'' directory:
CacheRoot lscache
This is to set the cache directory for this vhost in its home directory (such as ''/var/www/vhosts//lscache'').
Reconfigure this Virtual Host (this will regenerate new configuration files for this vhost).
/usr/local/psa/admin/bin/httpdmng --reconfigure-domain
===== Perform A Graceful Restart =====
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
===== Cache Policy Settings =====
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.
CacheLookup public on
===== Advanced Cache Configuration =====
For Advanced Cache Configuration info, **[[litespeed_wiki:cache:common_installation:advanced|look here]]**.