版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zwl18210851801/article/details/81708065
nginx.conf文件配置:
server {
listen 80;
server_name xxx.xxx.com;
# 通过此语句来映射静态资源
root /app/xxx/html/;
location ~ .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$
{
expires 7d;
}
location ~ .*\.(?:js|css)$
{
expires 7d;
}
location ~ .*\.(?:htm|html)$
{
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
}
第一次访问:
第二次访问: