Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a domain like images.example.com 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

1 Answer 1

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/mod_cache.so
LoadModule cache_disk_module modules/mod_cache_disk.so

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

Your Answer

 
discard

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.