我需要在 /
上打开登陆页面, 和 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;
}
}
它打开登陆
/
, 和 vueJS app 当我去 /app
时,但是,如果我打开 /app/login
它转到登录页面而不是 vue 应用程序。我究竟做错了什么 ?
最佳答案
我不知道为什么,但添加 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;
}
}
关于nginx + vueJS + 静态登陆页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47679208/