14 nginx 配置缓存

1 开启缓存,二级目录

 # 开启缓存,二级目录
    proxy_cache_path /usr/local/nginx/proxy_cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=20g;
    proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
    proxy_hide_header Cache-Control;
    proxy_hide_header Pragma;

2 静态文件加缓存

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|ico)?$
        {
            expires 1d;
            proxy_cache cache_one;
            proxy_cache_valid 200 304 1d;
            proxy_cache_valid any 1m;
            proxy_cache_key $host$uri$is_args$args;
            proxy_pass http://server_pool;
        }

3 清除缓存

 # 清除缓存
    location ~ /purge(/.*)
        {
            allow 127.0.0.1;
            allow 10.23.23.25;            allow 10.23.23.33;
            deny all;
            proxy_cache_purge cache_one $host$1$is_args$args;
        }
上一篇:[AWS vs Azure] 云计算里AWS和Azure的探究(4)


下一篇:jetpack之workmanager的基本使用