解决SPA单页面应用(create-react-app,Vue-cli)路由跳转后404的问题。
在Nginx中配置try_files
server {
listen 80;
server_name localhost;
root "****";
location / {
try_files $uri $uri/ /index.html;
index index.php index.html;
error_page 404 /error/404.html;
include ***;
autoindex off;
}
location /api/ {
proxy_pass http://localhost:8055;
}
}