Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a domain like served from Apache server. The requests that go there currently are images that are drawn using server-side language (PHP) and are cached on the application side but it seems like huge overhead to me.

Is there an easy way (Apache module) to cache every request that goes to images subdomain so that it doesn't reach the PHP at all, if it's still in the cache?

share|improve this question

Apache does include the mod_cache module, which implements RFC2616 compliant caching. You'll need to ensure that your PHP script sets appropriate Expires headers in its responses. Your config should look something like this:

LoadModule cache_module modules/
LoadModule cache_disk_module modules/

<Location /images>
    CacheRoot /var/cache/apache/sitename/images
    CacheEnable disk    
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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