Table of Contents

Web Cache Web Server Configuration - DirectAdmin Shared Hosting

This guide assumes that you have command-line access to the DirectAdmin Server.

Cache Storage Settings

Set Server level cache root

Add the following lines to the /etc/httpd/conf/extra/httpd-includes.conf file. check link here.

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

Note: It is recommended that you set the server level cache root to /home/lscache/ or a disk partition with enough space.

Set Virtual Host level cache root for all Virtual Hosts

Create a /usr/local/directadmin/data/templates/custom/cust_httpd.CUSTOM.2.pre file with: link here.

<IfModule Litespeed>
  CacheRoot lscache
</IfModule>

This is done to set each Virtual Hosts' cache directory to its home directory (/home/<user>/lscache).

Apply these changes to all Virtual Hosts by running the following command:

cd /usr/local/directadmin/custombuild
./build rewrite_confs

Cache Policy Settings

The default LiteSpeed Cache 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 as below:

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 document root .htaccess file to enable cache lookup.

<IfModule LiteSpeed>
  CacheLookup public on
</IfModule>

Perform A Graceful Restart

After applying your cache storage settings, perform a graceful restart of LiteSpeed Web Server to have these changes take effect. LiteSpeed Web Server will automatically create cache root directories with proper permissions. Users don't need to manually create any cache root directories themselves.

service lsws restart