mod_cache
is indeed the usual solution here if you want the Apache server to cache content for you.
You can not, as far as I'm aware, cache by file type or extension in mod_cache
-- the caching is controlled by URL and Header information (so if you want to cache all your images the easiest way to accomplish this is to serve them from an /images
directory, tell mod_cache
to cache stuff coming out of that directory, and let it do its magic).
mod_file_cache
is an alternative you can consider if the list of stuff you want to cache is static (a specific list of JS, images, CSS, etc.) -- there are some additional caveats there, particularly if you use MMapFile
to keep the files hot in memory, but the improved performance can be substantial over "traditional" caches like mod_cache
.
More good information on Apache's caching capabilities can be found in the caching section of the Apache docs, but I think the two options above are your best bets. If you need something better than those a CDN is probably more your speed.