https://blog.csdn.net/feiyu_may/article/details/88376945
解决方法
cd /etc/nginx
nano nginx.conf
在 location / 下方添加以下配置
location ~ .*\.(html)$ {add_header Cache-Control no-store;add_header Pragma no-cache;}
解释
原文链接:https://blog.csdn.net/feiyu_may/java/article/details/88376945
location ~ .*\.(html)$ { // 对html文件限制缓存add_header Cache-Control no-store; // 不缓存// 或者用add_header Cache-Control no-cache;替代上面那一句,协商缓存add_header Pragma no-cache;}
最终效果
server {listen 80;server_name localhost;location / {root /home/dist;try_files $uri $uri/ @router;index index.html;}location ~ .*\.(html)$ {add_header Cache-Control no-store;add_header Pragma no-cache;}error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}location @router {rewrite ^.*$ /index.html last;}}
修改 Nginx 配置后,重新加载
sudo systemctl reload nginx
