Question

I heard recently that Nginx has added caching to its reverse proxy feature. I looked around but couldn't find much info about it.

I want to set up Nginx as a caching reverse proxy in front of Apache/Django: to have Nginx proxy requests for some (but not all) dynamic pages to Apache, then cache the generated pages and serve subsequent requests for those pages from cache.

Ideally I'd want to invalidate cache in 2 ways:

  1. Set an expiration date on the cached item
  2. To explicitly invalidate the cached item. E.g. if my Django backend has updated certain data, I'd want to tell Nginx to invalidate the cache of the affected pages

Is it possible to set Nginx to do that? How?

Was it helpful?

Solution

OTHER TIPS

You can using memcached as cache engine and config NginxHttpMemcachedModule to perform caching base on URI as this link: http://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-boost/

The backend Django should set/update the data (both static and dynamic) in memcached.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top