我在nginx配置中进行了更改,如下所示: -

https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations

我的vue app目录就是这个

[/var/www/html]:$ls
dist  index.html  src
[/var/www/html]:$ls dist/
build.js  build.js.map

我的nginx配置就是这个

server {
            listen 80 default_server;
            listen [::]:80 default_server;
        server_name  localhost;

            location / {
                   root   /var/www/html;
                   index  index.html index.htm;
                   try_files $uri $uri/ /index.html;
            }

    }

但它似乎没有正确重定向 .

我的路由器设置如下

export const router = new Router({
  mode:'history',
  routes:[
  { path: ROUTE_PREFIX + '/login', name: 'login',component: loginPage },
  { path: ROUTE_PREFIX + '/dashboard' , component:dashboard},
  { path: ROUTE_PREFIX + '/abuse' , component: Abuse },
  { path: ROUTE_PREFIX + '/domainaction' , component: DomainAction },
  { path: ROUTE_PREFIX + '/status' , component: status},
  { path : ROUTE_PREFIX + '/backupfinder' , component: BackupFinder },
  {
      path : '*',
      redirect : ROUTE_PREFIX + '/dashboard'
    }
   ]
});