vueRouterMode
支持配置为 history
或 hash
,当配置为 history 时,若访问地址会报 404 的错误,此时需要配置 nginx 实现路由转发规则
nginx 配置
server {
listen 80 default_server;
listen [::]:80 default_server;
location / {
add_header Cache-Control 'no-store, no-cache';
root /data/ui/;
index index.html;
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://localhost:8000;
}
# You may need this to prevent return 404 recursion.
location = /404.html {
internal;
}
}