1.訪問頁面時 html 缺少了個 l 導致跳轉后台登錄頁面
處理方案 在nginx.conf 中添加一下配置 以下方法只能使用在小規模網站
# 首頁設置 index.html index.htm 訪問時 返回對應的index.html 內容
location ~* ^.+\index.(html|htm){
alias /opt/index.html; # 對應頁面 存放的index.html位置
}
-
由於使用了vue 與 負載均衡
所以會在nginx 中匹配 location /{}
改方法中將一些路徑 處理首頁 根路徑 "/"
location / {
# 匹配根路徑 返回首頁
if ( $request_uri = "/" ){
rewrite "/" /index.html break;
}# 負載均衡 if (-f $request_filename){ proxy_pass http://server; break; } }
由於后台 使用了vue 與 tomcat負載 ,並且沒有區分對應tomcat 的路徑 所以vue 中不能使用 mode:'history' 模式 否則會直接跳轉到后台的權限中