nginx + vueJS + 静态登陆页面

Val*_*era 5 nginx

我需要在 上打开登陆页面,在 上打开/vueJS 应用程序/app。这是我当前的 nginx 设置:

server {
    listen 80;

    location /app {
            alias /var/www/app/dist/;
            try_files $uri $uri/ /index.html;
    }

    location / {
            alias /var/www/landing/dist/;
            try_files $uri $uri/ /index.html;
    }
}
Run Code Online (Sandbox Code Playgroud)

/当我转到 时,它会打开登陆和 vueJS 应用程序/app,但是,如果我打开/app/login它会转到登陆页面而不是 vue 应用程序。我究竟做错了什么 ?

Val*_*era 8

我不知道为什么,但是添加last到 vue 应用程序配置中修复了它。这是配置现在的样子:

server {
    listen 80;

    location /app {
        alias /var/www/app/dist; # removed the / at the end
        try_files $uri $uri/ /index.html last; # here is the trick
    }

    location / {
        alias /var/www/landing/dist/;
        try_files $uri $uri/ /index.html;
    }
}
Run Code Online (Sandbox Code Playgroud)