0. 基本用法是 rewrite patten replace flag
1. break可以理解为switch中的break,而last可以理解为continue,一个是跳出server{}的匹配规则,一个还将继续匹配之后的规则。
无论使用last还是break,浏览器上面的地址栏不能被改变,而另外两个临时重定向302--redirect、永久重定向--permanent将改变浏览器上地址栏。
2. 官方文档的说明: http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
An optional flag parameter can be one of: last stops processing the current set of ngx_http_rewrite_module directives and starts a search for a new location matching the changed URI;
break stops processing the current set of ngx_http_rewrite_module directives as with the break directive;
redirect
returns a temporary redirect with the 302 code; used if a replacement string does not start with “http://”, “https://”, or “$scheme”;
permanent returns a permanent redirect with the 301 code.
参考:https://cloud.tencent.com/developer/news/65131