问题描述
Vue 采用 History 模式编译出的 build 文件,通过 nginx 部署到服务器以后,刷新页面会出现 404.通过修改以下配置解决
解决方法
server {
listen 80;
listen [::]:80;
server_name example.com;
root /var/www/example.com;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
参考资源