0

I did the setup of apache 2.4 with the below configurations

 ProxyPass      /       "http://localhost:9081/"
    ProxyPassReverse /     "http://localhost:9081/"
    <IfModule mod_cache.c>
            <IfModule mod_disk_cache.c>
            CacheRoot "/opt/apicache/"
            CacheDefaultExpire 3600
            CacheEnable disk "/"
            CacheDirLevels 2
            CacheDirLength 1
            CacheMaxFileSize 1000000
            CacheMinFileSize 1
            CacheIgnoreCacheControl On
            CacheIgnoreNoLastMod On
            CacheIgnoreQueryString Off
            CacheIgnoreHeaders None
            CacheLastModifiedFactor 0.1
            CacheDefaultExpire 3600
            CacheMaxExpire 86400
            CacheStoreNoStore On
            CacheStorePrivate On
            # Enable the X-Cache-Detail header
            CacheDetailHeader on
            </IfModule>
            </IfModule>

Also I changed the CacheRoot Permission by following

mkdir -p /opt/apicache/
chown root:www-data /opt/apicache/ -R
chmod 775 /opt/apicache/ -R

apache log level is set debug

LogLevel debug

Quite not sure why apache 2.4 not caching anything to the cache root and also does not show any logs in error logs

  • Maybe those modules aren't loaded. Why would you bother with IfModule? – covener May 02 '16 at 12:20
  • I can see cache modules are loaded with the below command . Ignore the fully qualified name error `root@INMHPUUBUNTU14:# ./apachectl -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using INMHPUUBUNTU14.04LAP08. Set the ' ServerName' directive globally to suppress this message Loaded Modules: core_module (static) . **cache_module (shared)** **cache_disk_module (shared)** .. alias_module (shared) rewrite_module (shared) ` – Prasanta Mohanty May 02 '16 at 13:44

2 Answers2

0

make sure apache can write to /opt/apicache/

chmod 766 /opt/apicache/
oguz ismail
  • 1
  • 16
  • 47
  • 69
Pavelm89
  • 1
  • 3
0

In my case, the cache was not working because the page size was greater than the CacheMaxFileSize.

XavierG84
  • 1
  • 1