共計 997 個字符,預計需要花費 3 分鐘才能閱讀完成。
本篇內容介紹了“nginx 解決 VUE 重定向刷新指向首頁的方法”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓丸趣 TV 小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
當用戶請求 http://localhost/example 時,這里的 $uri 就是 /example。try_files 會到硬盤里嘗試找這個文件。如果存在名為 /$root/example(其中 $root 是項目代碼安裝目錄)的文件,就直接把這個文件的內容發送給用戶。顯然,目錄中沒有叫 example 的文件。然后就看 $uri/,增加了一個 /,也就是看有沒有名為 /$root/example/ 的目錄。又找不到,就會 fall back 到 try_files 的最后一個選項 /index.php,發起一個內部“子請求”,也就是相當于 nginx 發起一個 HTTP 請求到 http://localhost/index.php。
` server {listen 808; #server_name rc.huanwei.tidecloud.com;
root /var/www/html;
index login.html index.htm;
#rewrite /index.html /login permanent;
location / { try_files $uri $uri/ [@router](https://my.oschina.net/u/2258684);
index index.html;
}
location [@router](https://my.oschina.net/u/2258684) {
rewrite ^.*$ /index.html last;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|html)$ {
root /var/www/html/rc.huanwei.tidecloud.com;
}
location /api-customer {
proxy_pass http://192.168.0.110:13200;
}
}
“nginx 解決 VUE 重定向刷新指向首頁的方法”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注丸趣 TV 網站,丸趣 TV 小編將為大家輸出更多高質量的實用文章!
正文完