Nginx 的靜態文件分布在不同的目錄下處理辦法


 location / {    
            
            # 默認去第一個目錄查找
            root html/static1;            
            index  index.html index.htm;                        
            
            # 如果文件沒有找到就繼續2
            if (!-e $request_filename) {                
                root html/static2;                
            }
            
            # 如果文件沒有找到就繼續3
            if (!-e $request_filename) {
                root html/static3;                
            }
            # 還沒有找到就定位到雲上去
            if (!-e $request_filename) {
                rewrite ^/(.*)$ https://www.hi-linux.com/$1;
            }
        }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM