I have followed the tutorial to setup Browser Caching on My Droplet: https://www.digitalocean.com/community/tutorials/how-to-configure-apache-content-caching-on-ubuntu-14-04

What I want to accomplish for now is set up a year-long cache on all files but later on will fine-tune files like HTML for a much shorter expiry.

I have checked my cache folder with below and it is growing: ls -la /var/cache/apache2/mod_cache_disk/

But the problem is Google Page Insight and other page speed tests are still reporting that there is not cache policy applied to my files even after 2 days of caching applied to the server.

I have also check edge dev tools and most files don't show Cache-Control in response and for some a small subset of files that it is shown, it is set to no-cache.

I included the following lines in my domain's virtual host file and enabled caching on my server:

CacheQuickHandler off
CacheLock on
CacheLockPath /tmp/mod_cache-lock
CacheLockMaxAge 5
CacheIgnoreHeaders Set-Cookie

<Location />
    CacheEnable disk
    CacheHeader on
    CacheDefaultExpire 600
    CacheMaxExpire 86400
    CacheLastModifiedFactor 0.5

    ExpiresActive on
    ExpiresDefault A31536000

    Header set Cache-Control public
    Header merge Cache-Control max-age=31536000
    FileETag All
  • Welcome to JSE, please take our tour. Commented Apr 10, 2021 at 14:22

1 Answer 1


After days of headache I finally solved it. I was editing the Virtual Host for HTTP and not the one for HTTPs/SLL. If any body faces this problem just search for active virtual host files on your server like below:

$ apachectl -S VirtualHost configuration: :443 de***.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2) :80 de***.com (/etc/apache2/sites-enabled/000-default.conf:1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.