WillSquire
5/6/2016 - 1:58 PM

Install and configure mod_cache on FreeBSD

Install and configure mod_cache on FreeBSD

mod_cache

Dependency

IMPORTANT: mod_cache utilises one of two different caching packages, one of which caches data on the hard disk (mod_cache_disk) and the other caches on the RAM (mod_cache_socache). To setup one of these, see https://gist.github.com/WillSquire/0bbc205f128e23d331d90bc759717759

Installation

Open Apache config file:

sudo ee /usr/local/etc/apache24/httpd.conf

Ensure the following directive is uncommented (by removing any # prefix if present) to activate mod_cache:

LoadModule cache_module libexec/apache24/mod_cache.so

Configuration

Create and open mod_cache.conf:

sudo ee /usr/local/etc/apache24/Includes/mod_cache.conf

Add the following, save and exit:

<IfModule mod_cache.c>
    CacheEnable disk /
    CacheDefaultExpire 3600

    CacheLock on
    CacheLockPath /tmp/mod_cache-lock
    CacheLockMaxAge 5

    CacheHeader on
    CacheIgnoreHeaders Set-Cookie
</IfModule>

Restart Apache for changes to take effect:

sudo apachectl graceful

References