http {
...
upstream httpget {
server 192.168.44.104:8080;
}
proxy_cache_path /ngx_tmp levels= 1:2 keys_zone=test_cache:100m inactive=1d max_size=10g; # 临时文件存一天
server {
listen80;
server_name localhost;
location / {
proxy_pass http://httpget;
add_header Nginx-Cache "$upstream_cache_status";
proxy_cache test cache;
proxy_cache_valid 1h; # 请求资源过期时间
root html;
}
}
网友评论