| 
       
	在nginx 配置文件中经常会用到last与break指令。两者之间的区别在哪里呢? 
	复制代码代码如下: 
		if (cf->args->nelts == 4) { 
		} else if (ngx_strcmp(value[3].data, "break") == 0) { 
		} else if (ngx_strcmp(value[3].data, "redirect") == 0) { 
		} else if (ngx_strcmp(value[3].data, "permanent") == 0) { 
		} else { 
	break 与last的区别在于多了一行,regex->break_cycle = 1; 那么我们来看看这行语句具体有何含义。 
	具体在/src/http/ngx_http_script.c (1007行),代码段如下: 
	复制代码代码如下: 
		if (code->break_cycle) { 
		} else { 
	r->valid_location = 0; 表示break指令不会继续作用于之后的location域。 
	复制代码代码如下: 
		ngx_http_core_post_rewrite_phase(ngx_http_request_t *r, 
		ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
		if (!r->uri_changed) { 
	r->uri_changed = 0; 内核会跳出处理下一个请求。 
	总结:使用break指令后,不会继续作用于随后的location域,不会循环继续匹配。last指令恰恰相反。  | 
    
