# http://www.testpm.com/a/1.html ==> http://www.testpm.com/b/2.html location /a/1.html { # http://ip/a/1.html => http://ip/b/2.html rewrite .* /b/2.html last; # 如果后面的路径没有加http开头,则表示本站的路径, flag 没有写默认是last } location /b { root /usr/share/nginx/html; }