表现
VUE 使用‘history’路由模式,刷新页面后,则出现 404 Not Found
原因
nginx配置的根目录/xxx/dist下面压根没有’Menu/index’这个资源存在,这些资源都是在js里渲染的。
解决方案
vi nginx.conf
输入命令 i 进入编辑模式
location / {
root ...
index ...
try_files $uri $uri/ /index.html; ---解决页面刷新404问题
}
重启Nginx