美文网首页
nginx cache 配置

nginx cache 配置

作者: misspass | 来源:发表于2021-02-08 16:11 被阅读0次

nginx.conf :

proxy_cache_path /tmp/cache levels=1:2 keys_zone=my_cache:100m max_size=10g inactive=60m use_temp_path=off;

www.xxx.com.conf:

server {
    ...
    location / {

        #proxy_cache_min_uses 3;
        proxy_cache my_cache;
        proxy_cache_key $host$uri$is_args$args;
        proxy_cache_methods GET HEAD;
        proxy_cache_valid 200 24h;
        proxy_cache_valid any 10m;
        add_header X-Cache-Status $upstream_cache_status; 

        proxy_pass http://localhost:8000;
    }
}

相关文章

网友评论

      本文标题:nginx cache 配置

      本文链接:https://www.haomeiwen.com/subject/nrgbtltx.html