以前的spa单页面的nginx配置
try_files $uri /index.html;
仔细看打包出来的dist目录,发现每个路由都生成了对应的*.html文件。
所以修改nginx
nginx配置如下:
location / {
# 将以.html结尾的请求添加Cache-Control头信息
if ($uri ~* \.(html)$) {
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
# 默认情况下,根据路径转发,找不到加载index.html
try_files $uri /$uri.html /index.html;
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。