3.禁止浏览器缓存

在服务器上创建一个文件nocached.conf,建议放置在目录/usr/local/nginx/conf/pugin

#如果不希望客户端浏览器缓存文件,可以在这里配置
#这不要客户端缓存文件 serviceworker.js
location ~* (serviceworker.js)$ {
  add_header Last-Modified $date_gmt;
  add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
  if_modified_since off;
  expires off;
  etag off;
}

然后再在虚拟主机配置文件(vhost/www.domain.com.conf)文件中引入这个文件

include /usr/local/nginx/conf/pugin/nocached.conf;

如果没有其他特殊情况,以上的配置项,也可以加载到移动端虚拟主机配置文件中共用

results matching ""

    No results matching ""