This is an old revision of the document!
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 editing Apache configuration files through the Plesk GUI.
Cache Storage Settings
Set Server level cache root
Create a file named “lscache.conf” with the following content in directory /etc/httpd/conf.d/
for CentOS and /etc/apache2/conf.d/
for Debian/Ubuntu:
<IfModule Litespeed> CacheRoot /var/www/vhosts/lscache/ </IfModule>
Note: It is recommended to 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 it's 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 content to the proper location (we recommend inserting after the mod_suexec.c block):
<IfModule LiteSpeed> CacheRoot lscache </IfModule>
This is to set cache directory for each vhost in their 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 Hosts Settings Using Configuration Templates.
Set Virtual Host level cache root for a single VHost
If it does not already exist, create a file named “vhost.conf” ( or “vhost_ssl.conf” for HTTPS sites) with the following content in directory /var/www/vhosts/system/<domain_name>/conf/
:
<IfModule Litespeed> CacheRoot lscache </IfModule>
This is to set 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>
Perform A Graceful Restart
After applying 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. User doesn't need to manually create any cache root directory.
service lsws restart
Cache Policy Settings
LiteSpeed Cache default settings work well with most caching scenarios. For shared hosting environment, please don't change any of the Server Level default cache policy settings and 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>
Advanced Cache Configuration
For Advanced Cache Configuration info, look here.