Modify the default.conf file
location / { root /usr/share/nginx/html/school-static; index index.html index.htm; If ($request_filename ~*.*\.(? :htm|html)$) { add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; } if ($request_filename ~* .*\.(? :js|css)$) { expires 7d; } if ($request_filename ~* .*\.(? :jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$) { expires 7d; }}Copy the code
Modify the public/index.html file
<meta http-equiv="pragram" content="no-cache"> <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">Copy the code