vue單頁面的啓動頁面是index.html,路由的路徑實際是不存在的,所以會出現訪問單頁面404問題,需要設置所有找不到的路徑直接映射到index.html
root D:/nginx-0.8.55/html/dist/;
index index.html index.htm;
location / {
try_files $uri $uri @router;
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
location /api/ {
proxy_pass http://192.168.8.133:8090/api/;
}