How to configure Nginx as a caching reverse proxy?

I recently heard that Nginx has added caching to its reverse proxy function. I looked around, but could not find much information about this.

I want to configure Nginx as a reverse cache proxy before Apache / Django: have a Nginx proxy for some (but not all) dynamic pages for Apache, then cache the created pages and serve subsequent requests for these pages from the cache.

Ideally, I would like to invalidate the cache in two ways:

  • Set expiration date for cached item
  • To explicitly invalidate a cached item. For example. if my Django backend has updated certain data, I want to tell Nginx about the invalid cache of the affected pages.

Is it possible to install Nginx for this? How?

+3
source share
2 answers

You can use memcached as a caching mechanism and configure NginxHttpMemcachedModule to perform database caching in the URI, like this link: http://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-boost/

The Django backend must install / update data (both static and dynamic) in memcached.

+1
source

Source: https://habr.com/ru/post/1711140/


All Articles