Mercurial > hg > nginx-site
annotate xml/ru/docs/http/ngx_http_slice_module.xml @ 2081:f29bd40e9a62
Development guide: documented ngx_create_pool() size requirements.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Tue, 05 Dec 2017 16:54:22 +0300 |
parents | 6299f9cabfe4 |
children | 4add6ae1296f |
rev | line source |
---|---|
1616
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
9 <module name="Модуль ngx_http_slice_module" |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
10 link="/ru/docs/http/ngx_http_slice_module.html" |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="ru" |
1886
6299f9cabfe4
Changed <literal> to <value> in the slice directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1802
diff
changeset
|
12 rev="3"> |
1616
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
13 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
14 <section id="summary"> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
15 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
16 <para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
17 Модуль <literal>ngx_http_slice_module</literal> (1.9.8) — это фильтр, |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
18 который разбивает запрос на подзапросы, |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
19 каждый из которых возвращает определённый диапазон ответа. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
20 Фильтр обеспечивает более эффективное кэширование больших ответов. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
21 </para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
22 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
23 <para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
24 По умолчанию этот модуль не собирается, его сборку необходимо |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
25 разрешить с помощью конфигурационного параметра |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
26 <literal>--with-http_slice_module</literal>. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
27 </para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
28 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
29 </section> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
30 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
31 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
32 <section id="example" name="Пример конфигурации"> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
33 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
34 <para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
35 <example> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
36 location / { |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
37 <emphasis>slice</emphasis> 1m; |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
38 proxy_cache cache; |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
39 proxy_cache_key $uri$is_args$args<emphasis>$slice_range</emphasis>; |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
40 proxy_set_header Range <emphasis>$slice_range</emphasis>; |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
41 proxy_cache_valid 200 206 1h; |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
42 proxy_pass http://localhost:8000; |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
43 } |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
44 </example> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
45 В данном примере |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
46 ответ разбивается на кэшируемые фрагменты размером в 1 мегабайт. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
47 </para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
48 </section> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
49 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
50 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
51 <section id="directives" name="Директивы"> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
52 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
53 <directive name="slice"> |
1886
6299f9cabfe4
Changed <literal> to <value> in the slice directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1802
diff
changeset
|
54 <syntax><value>размер</value></syntax> |
1616
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
55 <default>0</default> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
56 <context>http</context> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
57 <context>server</context> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
58 <context>location</context> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
59 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
60 <para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
61 Задаёт <value>размер</value> фрагмента. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
62 Нулевое значение запрещает разбиение ответов на фрагменты. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
63 Обратите внимание, что слишком низкое значение может привести |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
64 к излишнему потреблению памяти |
1802
51e1c73cc027
Rephrased file descriptors in the "slice" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1616
diff
changeset
|
65 и открытию большого количества файлов. |
1616
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
66 </para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
67 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
68 <para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
69 Для того, чтобы подзапрос вернул необходимый диапазон, |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
70 переменная <var>$slice_range</var> должна быть |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
71 <link doc="ngx_http_proxy_module.xml" id="proxy_set_header">передана</link> на |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
72 проксируемый сервер в качестве поля <literal>Range</literal> заголовка запроса. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 Если включено |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
74 <link doc="ngx_http_proxy_module.xml" id="proxy_cache">кэширование</link>, |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
75 то необходимо добавить <var>$slice_range</var> в |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
76 <link doc="ngx_http_proxy_module.xml" id="proxy_cache_key">ключ |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
77 кэширования</link> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
78 и <link doc="ngx_http_proxy_module.xml" id="proxy_cache_valid">включить</link> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
79 кэширование ответов с кодом 206. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
80 </para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
81 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
82 </directive> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
83 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
84 </section> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
85 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
86 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
87 <section id="variables" name="Встроенные переменные"> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
88 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
89 <para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
90 Модуль <literal>ngx_http_slice_module</literal> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
91 поддерживает следующие встроенные переменные: |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
92 <list type="tag"> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
93 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
94 <tag-name id="var_slice_range"><var>$slice_range</var></tag-name> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
95 <tag-desc> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
96 текущий диапазон фрагмента в формате |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
97 <link url="https://tools.ietf.org/html/rfc7233#section-2.1">HTTP |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
98 byte range</link>, |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
99 например <literal>bytes=0-1048575</literal>. |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
100 </tag-desc> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
101 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
102 </list> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
103 </para> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
104 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
105 </section> |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
106 |
9e8ec9c67cf3
Documented ngx_http_slice_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
107 </module> |