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;
            }
        }

 

posted @ 2020-02-12 13:42  糖豆爸爸  阅读(1660)  评论(0编辑  收藏  举报
Live2D