访问http://labs.frickle.com/nginx_ngx_cache_purge/下载一个tar包
还有www.nginx.org下载
wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz wget http://nginx.org/download/nginx-1.4.3.tar.gz
然后都解压出来.
使用下面命令进行配置和编译
./configure --with-http_stub_status_module --with-http_ssl_module --add-module=../ngx_cache_purge-2.1 make make install
在nginx.conf里增加配置
proxy_cache_path cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;
然后增加vhost目录里的文件
erver{ server_name 7ydj.com *.7ydj.com 176jh.com *.176jh.com; listen 0.0.0.0:80; location / { proxy_pass https://211.144.85.11:60443/; proxy_cache cache_one; proxy_cache_valid 200 302 1h; proxy_cache_valid 301 1d; proxy_cache_valid any 1m; proxy_cache_key $uri$is_args$args; proxy_cache_purge PURGE from 127.0.0.1; expires 1m; } location ~ /purge(/.*) { root html; proxy_cache_purge cache_one $host$1$is_args$args; } access_log off; }