我想*.html
在 Nginx 反向代理中缓存所有文件,所以我添加了配置:
# Original configuration
location = / {
proxy_pass http://192.168.12.12:91;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Added for cache
location ~ \.html {
proxy_pass http://192.168.12.12:91;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 301 302 1m;
proxy_cache_valid any 1m;
expires 1m;
}
proxy_pass
重复两次proxy_set_header
感觉不好
我该如何优化呢?谢谢!