> For the complete documentation index, see [llms.txt](https://bohans.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bohans.gitbook.io/devops/ngnix/ji-chu-zhi-shi/4.-nginx-fu-wu-qi-de-dai-li-fu-wu/4.5-rewrite/xiang-guan-zhi-ling/break-zhi-ling.md).

# break指令

<mark style="color:blue;">**break指令**</mark>用于**中断当前相同作用域中的其他Nginx配置**。与该指令处于同一作用域的Nginx配置中，位于它前面的指令配置生效，位于后面的指令配置无效。Nginx服务器在根据配置处理请求的过程中遇到该指令时，回到上一层作用域继续向下读取配置。

其语法结构为：

```nginx
break;
```

<details>

<summary>Example</summary>

```nginx
location / {
    if ($slow) {
        set $id $1;         # 处于break指令之前，配置有效
        break;
        limit_rate 10k;     # 处于break指令之后，配置无效
    }
    …  # 其他Nginx配置，处于break指令所在作用域的上一层作用域，配置有效
}
```

</details>

{% hint style="info" %} <mark style="color:blue;">**该指令可以在server块和location块以及 if 块中使用**</mark>
{% endhint %}
