> For the complete documentation index, see [llms.txt](https://docshome.gitbook.io/nginx-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docshome.gitbook.io/nginx-docs/he-xin-gong-neng/http/ngx_http_split_clients_module.md).

# ngx\_http\_split\_clients\_module

* [示例配置](/nginx-docs/he-xin-gong-neng/http/ngx_http_split_clients_module.md#example_configuration)
* [指令](/nginx-docs/he-xin-gong-neng/http/ngx_http_split_clients_module.md#directives)
  * [split\_clients](/nginx-docs/he-xin-gong-neng/http/ngx_http_split_clients_module.md#split_clients)

`ngx_http_split_clients_module` 模块用于创建适用于 A/B 测试的变量，也称为拆分测试。

## 示例配置 <a href="#example_configuration" id="example_configuration"></a>

```
http {
    split_clients "${remote_addr}AAA" $variant {
                   0.5%               .one;
                   2.0%               .two;
                   *                  "";
    }

    server {
        location / {
            index index${variant}.html;
```

## 指令 <a href="#directives" id="directives"></a>

### split\_clients

| -       | 说明                                             |
| ------- | ---------------------------------------------- |
| **语法**  | **split\_clients** `string $variable { ... }`; |
| **默认**  | ——                                             |
| **上下文** | http                                           |

创建一个用于 A/B 测试的变量。

```
split_clients "${remote_addr}AAA" $variant {
               0.5%               .one;
               2.0%               .two;
               *                  "";
}
```

使用 MurmurHash2 对原始字符串的值进行哈希处理。在以上示例中，哈希值从 0 到 21474835（0.5％）对应 `$variant` 变量的值为 `.one`，哈希值从 21474836 到 107374180（2％）对应的值为 `.two`，哈希值从 107374181 到 4294967295 对应值为 `""`（空字符串）。

## 原文档

<http://nginx.org/en/docs/http/ngx_http_split_clients_module.html>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docshome.gitbook.io/nginx-docs/he-xin-gong-neng/http/ngx_http_split_clients_module.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
