Nginx - js/css 404 子路徑缺失替換方法
Published in:2023-06-29 | category: Web


原因: 按下 F12 後,所有 js/css 全部變404 (當前路徑少一層目錄)



使用參數 sub_filter 替換該路徑



EX:



location ^~ /note {
alias  /root/web-server/config2/public/;
sub_filter_types *;
sub_filter '/css/' '/note/css/';
sub_filter '/lib/' '/note/lib/';
sub_filter '/svg/' '/note/svg/';
sub_filter '/js/' '/note/js/';
sub_filter '/tags/' '/note/tags/';
sub_filter '/fixit.min.svg' '/note/fixit.min.svg';
sub_filter_once off;
access_log /root/web-server/hugoserver.acc;
}   






***
Prev:
HEXO - 解決圖片無法顯示
Next:
Windows - 如何關閉晃動視窗不再最小化其他視窗