1者铜、直接location匹配
location ~ .*.(htm|html)?$ {
? ? add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
2、直接在loaction中添加 if 語句
location / {
????if ($request_filename ~ .*.(htm|html)?$){
????????add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
????}
}
注意:if 和try_files一起使用會有沖突松申,可以在try_files后面再加一個(gè)loaction來解決铝条。