Vue3项目history路由模式,nginx对应的配置

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

    root   /usr/share/nginx/html;
    index index.html index.htm;

    location / {
        try_files $uri $uri/ /index.html;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

这种模式下,打包之后dist目录下的文件夹名称和后端的api地址,都不能作为前端的路由。


Comments

Leave a Comment