location ~* html {
rewrite .* /index.html break;
}
location /login {
rewrite .* /index.html break;
}
location /admin {
rewrite .* /index.html break;
}
- 通用单页路由指定
location / {
try_files $uri $uri/ /index.html index.htm;
}
或者
location / {
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^(.+)$ /index.html last;
}
参考:https://developer.jdcloud.com/article/2105
Original: https://www.cnblogs.com/mengff/p/16384662.html
Author: 看风景就
Title: nginx单页应用配置
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/543609/
转载文章受原作者版权保护。转载请注明原作者出处!