部署后,请求资源就404
location ^~ /open/ {
alias html/static/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
10.1.1.1/open/#/
默认访问静态资源是代open的,但是点击二级菜单就不带了
访问的是open,点击二级菜单的时候就404了
或者说如何让html/static/目录里的所有静态资源,判断是open开头,开头有的话就不带,没有就带上
location ^~ /open/ {
alias html/static/;
index index.html index.htm;
}
修改
vue.config.js
当中的publicPath
为/open/
或者./
就行了。如果后期想要从
hash
路由模式 转换成history
模式,再单独配置try_files
就行了。