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