二级目录
ng设置
location /wisdom-web/ {
try_files $uri $uri/ /wisdom-web/index.html;
alias /home/data/web/dist/;
index index.html index.htm;
}
location ^/wisdom-web/(.*)\.(js|css|jpg|png|jpeg|svg|woff|ico|tff)$ {
alias /home/data/web/dist/;
expires 30d;
}
代码设置
const router = new VueRouter({
mode: "history", // history|hash
base:'/wisdom-web/',
routes, // (缩写) 相当于 routes: routes
});
vue.config.js
publicPath: "/wisdom-web/",
根目录
server
{
listen 9090;
access_log off;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
root /web/dist/;
location / {
try_files $uri $uri/ /index.html;
}
location ~.*\.(js|css|jpg|png|jpeg|svg|woff|ico|tff)$ {
expires 30d;
}
}
代码设置
const router = new VueRouter({
mode: "history", // history|hash
routes, // (缩写) 相当于 routes: routes
});
vue.config.js
publicPath: "./",