宇文氏 发表于 2018-11-15 06:00:10

Nginx自学手册(三)location匹配,rewrite

server {  
         listen    80;
  
         server_namexn2.lqb.com;
  
         root    /html/xn2/;
  
         location /{
  
               index index.html;
  
                   }
  
         error_page404   /404.html;
  

  
         }
  
server {
  
         listen    80;
  
         server_namexn3.lqb.com;
  
         root /html/xn3;
  
         location = / {
  
               rewrite ^/(.*) xn2.lqb.com permanent;
  
               index index.html;
  
                   }
  
          error_page500 502 503 504   /50x.html;
  
          location=/50x.html{
  
                      root /html/xn3;
  
                            }
  
         }


页: [1]
查看完整版本: Nginx自学手册(三)location匹配,rewrite