美文网首页
vue history nginx 刷新404

vue history nginx 刷新404

作者: 漫画三毛 | 来源:发表于2022-08-19 15:00 被阅读0次
  1. 二级目录配置
    location ^~ /mobile {
            root /www/wwwroot/;
            try_files $uri $uri/ @router;
    }
    
    #对应上面的@router,主要原因是路由的路径资源并不是一个真实的路径,所以无法找到具体的文件
    #因此需要rewrite到index.html中,然后交给路由在处理请求资源
    location @router {
        rewrite ^.*$ /mobile/index.html last;
    }
注意:和一级目录不一样的地方是 @router rewrite 需要指定目录下的index.html

相关文章

网友评论

      本文标题:vue history nginx 刷新404

      本文链接:https://www.haomeiwen.com/subject/brdugrtx.html