Apache configuration directives

LiteSpeed’s Apache-style configuration directives must be nested in <IfModule LiteSpeed> and </IfModule> tags. This is to prevent any possible incompatibility issues. For example:

<IfModule LiteSpeed> 
 CacheEnable public /
 CacheRoot /dev/shm/cacheroot
 CacheMaxExpire 604800
</IfModule>

syntax: CacheEnable [cache_type] [url-string]

The CacheEnable directive instructs LiteSpeed Web Server to cache urls at or below url-string. Both public and private caches can be enabled based on the value specified with the cache_type argument.

# Enable public cache
CacheEnable public /
# Enable private cache
CacheEnable private /

syntax: CacheDisable [cache_type] [url-string]

The CacheDisable directive instructs LiteSpeed Web Server to not cache urls at or below url-string. Both public and private caches can be disabled based on the value specified with the cache_type argument.

# Disable public cache
CacheDisable public /
# Disable private cache
CacheDisable private /

syntax: CacheRoot directory

The CacheRoot directive defines the name of the directory on the disk to contain cache files.

CacheRoot /dev/shm/cacheroot

syntax: CacheMaxFileSize bytes

The CacheMaxFileSize directive sets the maximum size, in bytes, for an object to be considered for storage in the cache.

CacheMaxFileSize 64000

syntax: CacheIgnoreCacheControl On|Off

Ordinarily, requests containing a Cache-Control: no-cache or Pragma: no-cache header value will not be served from the cache. The CacheIgnoreCacheControl directive allows this behavior to be overridden. CacheIgnoreCacheControl On tells the server to attempt to serve the resource from the cache even if the request contains no-cache header values. Resources requiring authorization will never be cached.

CacheIgnoreCacheControl On
Warning:
This directive will allow serving from the cache even if the client has requested that 
the document not be served from the cache. This might result in stale content being served.

syntax: CacheMaxExpire seconds

The CacheMaxExpire directive specifies the maximum number of seconds for which cacheable HTTP documents will be retained without checking the origin server. Thus, documents will be out of date at most this number of seconds. This maximum value is enforced even if an expiry date was supplied with the document.

CacheMaxExpire 604800

syntax: CacheLookup public on|off

The CacheLookup directive instructs LiteSpeed Web Server on whether or not to check public cache. Typically, on a web server level, you want to set this off with the following directive:

CacheLookup public off

And then turn it on at a per-site basis with the following directive:

CacheLookup public on
  • Admin
  • Last modified: 2017/03/01 19:20
  • by Kevin Fwu