FAQ

Page Discussion Edit History

NginxChsCachePurge

Contents

ngx_cache_purge

本模块由第三方提供,不包含在 Nginx 的源码发布版中。

说明

ngx_cache_purge is nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches.

安装

下载模块源码:ngx_cache_purge-1.2(更新记录)
(SHA1: d9468cf42432e81ea3a110ec63aae2eb273f5516)

其他版本

解压,然后编译:

./configure
make && make install

配置指令

 fastcgi_cache_purge zone_name key (context: location)

Sets area and key used for purging selected pages from FastCGI's cache.

 proxy_cache_purge zone_name key (context: location)

Sets area and key used for purging selected pages from proxy's cache.

 scgi_cache_purge zone_name key (context: location)

Sets area and key used for purging selected pages from SCGI's cache.

 uwsgi_cache_purge zone_name key (context: location)

Sets area and key used for purging selected pages from uWSGI's cache.

示例配置

http {
    proxy_cache_path  /tmp/cache  keys_zone=tmpcache:10m;

    server {
        location / {
            proxy_pass         http://127.0.0.1:8000;
            proxy_cache        tmpcache;
            proxy_cache_key    $uri$is_args$args;
        }

        location ~ /purge(/.*) {
            allow              127.0.0.1;
            deny               all;
            proxy_cache_purge  tmpcache $1$is_args$args;
        }
    }
}

SPONSORS

Work on the original patch was fully funded by yo.se.