nginx-缓存

缓存内容并定义缓存的存储位置。
proxy_cache_path /var/nginx/cache
                              keys_zone=CACHE:60m
                              levels=1:2                 
                              inactive=3h        
                              max_size=20g;
proxy_cache CACHE;
 
proxy_cache_path 在 http 上下文中有效,proxy_cache 指令在 http、server 和 location 上下文中有效。
 
客户端缓存
通过在客户端缓存内容来提高性能。
使用客户端的 cache-control HTTP 请求头:
location ~* \.(css|js)$ {
expires 1y;
add_header Cache-Control "public";
}
posted @ 2023-09-18 21:09  ~技术小白  阅读(11)  评论(0编辑  收藏  举报