Configuring Apache to Cache Static Content via mod_disk_cache

Redirection notice

This page will redirect to /display/KB/Proxying+Atlassian+Server+applications .

To improve performance of a large Confluence site, we recommend that you move the caching of static content from the JVM into Apache. This will prevent the JVM from having a number of long running threads serving up static content.

Static content in Confluence includes most JavaScript, CSS and image files which are included with the application or an installed plugin. This content will be cached by Apache in this configuration. User-provided content like space logos, attachments or embedded images are not considered static content and will not be cached.

Note: This page documents a configuration of Apache, rather than of Confluence itself. Atlassian will support Confluence with this configuration, but we cannot guarantee to help you debug problems with Apache. Please be aware that this material is provided for your information only, and that you use it at your own risk.

Configuring Apache mod_disk_cache

 To configure Apache to cache static Confluence content:

  1. Add a mod_disk_cache stanza to the virtual host configuration:

    <IfModule mod_disk_cache.c>
      # "/s" is where Confluence serves "static" stuff. Instruct Apache to cache it:
      CacheEnable disk /s
      CacheIgnoreHeaders Set-Cookie
      CacheRoot "/var/cache/mod_proxy"
  2. Configure Apache to load mod_disk_cache. For example, in our server configuration this is done in /etc/httpd/conf/httpd.conf:

    LoadModule disk_cache_module modules/
  3. Restart Apache after both modifications are complete.


  • Please refer to the Apache documentation for mod_disk_cache.
  • If you encounter problems where users are served stale content, you may need to purge the Apache cache directory (/var/cache/mod_proxy in the above configuration) after a Confluence or plugin upgrade. This is a simple 3 step process:
    • Shut down Apache.
    • Clear the cache directory. For example: sudo rm -r /var/cache/mod_proxy/*
    • Restart Apache.
  • Ensure that you are running the htcacheclean daemon in order to prevent excessive use of disk space. In our situation we ran it like this:

    sudo htcacheclean -d30 -n -t -p /var/cache/mod_proxy -l 512M

    This will purge content once the cache reaches 512M every 30 minutes.  See the Apache documentation for htcacheclean for details of the options.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport