vue部署在nginx禁止html文件缓存
主要是匹配到 location ~.*\.(html)$
就添加请求头,禁止缓存:add_header 'Cache-Control' 'private,no-store,no-cache,must-revalidate,proxy-revalidate';
server {
listen 80;
server_name admin.yongit.com;
set $package 'com.yongit.admin';
index index.html index.htm index.php;
root /datas/website/$package/public;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~.*\.(html)$
{
add_header 'Cache-Control' 'private,no-store,no-cache,must-revalidate,proxy-revalidate';
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 7d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
location /api/{
proxy_pass http://api.yongit.com/;
}
location ~ .*.(svn|git|cvs){deny all;}
access_log /datas/logs/nginx/$package.log;
}