nginx之Rewrite Rules(十三)

servername1, servername2

 server{
    listen 80;
    server_name servername1;
    
     location / {
         xx
     }
  }

  server{
    listen 80;
    server_name servername2;
    
     location / {
         xx
     }
  }
  server {

    listen 80;
    server_name servername1, servername2;
    
    location / {
        if($http_host == servername1) {
             rewrite (.*)  http://servername1$1;
        }
    }    
  }

try_files


   server {

    listen 80;
    server_name localhost;

    location /a {
        root /html;
        try_files $uri $uri/ /others/$uri.html;
    }

   }

posted @ 2020-09-15 08:56  pengsn  阅读(212)  评论(0编辑  收藏  举报