1.上线后项目的访问链接中需带有项目名字,
Vue:中,1.在vite.config中加base
2.路由中 history: createWebHistory("/intellegentAnalysis/")
1.1 Nginx 文件的配置,按照原来的请求会找不到build后的压缩文件,故使用rewrite掉项目的名字
server {
listen 4002;
server_name localhost;
access_log logs/host.access.log main;
location ~* \.(gif|jpg|jpeg|png|css|js|ico|svg)$ {
rewrite /intellegentAnalysis/?(.*)$ /$1 break;
}
location /intellegentAnalysis/ {
rewrite /intellegentAnalysis/?(.*)$ /$1 break;
}
location / {
root html;
index index.html index.htm;
}
}