annotate xml/en/docs/http/ngx_http_upstream_module.xml @ 1568:61a3285d77aa

Paraphrased the ALPN/NPN requirements note so it makes sense.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 17 Sep 2015 20:50:25 +0300
parents ed420c318557
children 201bf8fa69e5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1 <?xml version="1.0"?>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2
580
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 566
diff changeset
3 <!--
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 566
diff changeset
4 Copyright (C) Igor Sysoev
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 566
diff changeset
5 Copyright (C) Nginx, Inc.
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 566
diff changeset
6 -->
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 566
diff changeset
7
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
9
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
10 <module name="Module ngx_http_upstream_module"
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
11 link="/en/docs/http/ngx_http_upstream_module.html"
589
764fbac1b8b4 Added document revision.
Ruslan Ermilov <ru@nginx.com>
parents: 580
diff changeset
12 lang="en"
1561
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
13 rev="42">
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
14
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
15 <section id="summary">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
16
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
17 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
18 The <literal>ngx_http_upstream_module</literal> module
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
19 is used to define groups of servers that can be referenced
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
20 by the <link doc="ngx_http_proxy_module.xml" id="proxy_pass"/>,
1181
b8f0362f61e5 Added links to scgi.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1155
diff changeset
21 <link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass"/>,
1194
9264fdb6c833 Added links to uwsgi.
Ruslan Ermilov <ru@nginx.com>
parents: 1186
diff changeset
22 <link doc="ngx_http_uwsgi_module.xml" id="uwsgi_pass"/>,
1181
b8f0362f61e5 Added links to scgi.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1155
diff changeset
23 <link doc="ngx_http_scgi_module.xml" id="scgi_pass"/>, and
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
24 <link doc="ngx_http_memcached_module.xml" id="memcached_pass"/> directives.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
25 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
26
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
27 </section>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
28
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
29
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
30 <section id="example" name="Example Configuration">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
31
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
32 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
33 <example>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
34 upstream <emphasis>backend</emphasis> {
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
35 server backend1.example.com weight=5;
1424
410e0683b6b4 Rolled back changes in the example of the upstream module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1423
diff changeset
36 server backend2.example.com:8080;
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
37 server unix:/tmp/backend3;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
38
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
39 server backup1.example.com:8080 backup;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
40 server backup2.example.com:8080 backup;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
41 }
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
42
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
43 server {
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
44 location / {
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
45 proxy_pass http://<emphasis>backend</emphasis>;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
46 }
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
47 }
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
48 </example>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
49 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
50
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
51 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
52 Dynamically configurable group,
1128
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
53 available as part of our
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
54 <commercial_version>commercial subscription</commercial_version>:
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
55 <example>
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
56 resolver 10.0.0.1;
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
57
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
58 upstream <emphasis>dynamic</emphasis> {
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
59 zone upstream_dynamic 64k;
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
60
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
61 server backend1.example.com weight=5;
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
62 server backend2.example.com:8080 fail_timeout=5s slow_start=30s;
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
63 server 192.0.2.1 max_fails=3;
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
64 server backend3.example.com resolve;
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
65
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
66 server backup1.example.com:8080 backup;
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
67 server backup2.example.com:8080 backup;
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
68 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
69
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
70 server {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
71 location / {
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
72 proxy_pass http://<emphasis>dynamic</emphasis>;
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
73 health_check;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
74 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
75 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
76 </example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
77 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
78
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
79 </section>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
80
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
81
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
82 <section id="directives" name="Directives">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
83
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
84 <directive name="upstream">
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
85 <syntax block="yes"><value>name</value></syntax>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
86 <default/>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
87 <context>http</context>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
88
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
89 <para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
90 Defines a group of servers.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
91 Servers can listen on different ports.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
92 In addition, servers listening on TCP and UNIX-domain sockets
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
93 can be mixed.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
94 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
95
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
96 <para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
97 Example:
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
98 <example>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
99 upstream backend {
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
100 server backend1.example.com weight=5;
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
101 server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
102 server unix:/tmp/backend3;
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
103
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
104 server backup1.example.com backup;
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
105 }
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
106 </example>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
107 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
108
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
109 <para>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
110 By default, requests are distributed between the servers using a
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
111 weighted round-robin balancing method.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
112 In the above example, each 7 requests will be distributed as follows:
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
113 5 requests go to <literal>backend1.example.com</literal>
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
114 and one request to each of the second and third servers.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
115 If an error occurs during communication with a server, the request will
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
116 be passed to the next server, and so on until all of the functioning
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
117 servers will be tried.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
118 If a successful response could not be obtained from any of the servers,
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
119 the client will receive the result of the communication with the last server.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
120 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
121
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
122 </directive>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
123
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
124
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
125 <directive name="server">
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
126 <syntax><value>address</value> [<value>parameters</value>]</syntax>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
127 <default/>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
128 <context>upstream</context>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
129
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
130 <para>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
131 Defines the <value>address</value> and other <value>parameters</value>
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
132 of a server.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
133 The address can be specified as a domain name or IP address,
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
134 with an optional port, or as a UNIX-domain socket path
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
135 specified after the “<literal>unix:</literal>” prefix.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
136 If a port is not specified, the port 80 is used.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
137 A domain name that resolves to several IP addresses defines
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
138 multiple servers at once.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
139 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
140
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
141 <para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
142 The following parameters can be defined:
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
143 <list type="tag">
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
144
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
145 <tag-name id="weight">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
146 <literal>weight</literal>=<value>number</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
147 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
148 <tag-desc>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
149 sets the weight of the server, by default, 1.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
150 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
151
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
152 <tag-name id="max_fails">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
153 <literal>max_fails</literal>=<value>number</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
154 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
155 <tag-desc>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
156 sets the number of unsuccessful attempts to communicate with the server
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
157 that should happen in the duration set by the <literal>fail_timeout</literal>
968
fa19bacf6e1e Unified upstream server up/down state terminology.
Vladimir Homutov <vl@nginx.com>
parents: 966
diff changeset
158 parameter to consider the server unavailable for a duration also set by the
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
159 <literal>fail_timeout</literal> parameter.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
160 By default, the number of unsuccessful attempts is set to 1.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
161 The zero value disables the accounting of attempts.
942
ba3d6ade3513 Elaborate on upstream server failures.
Ruslan Ermilov <ru@nginx.com>
parents: 917
diff changeset
162 What is considered an unsuccessful attempt is defined by the
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
163 <link doc="ngx_http_proxy_module.xml" id="proxy_next_upstream"/>,
1181
b8f0362f61e5 Added links to scgi.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1155
diff changeset
164 <link doc="ngx_http_fastcgi_module.xml" id="fastcgi_next_upstream"/>,
1194
9264fdb6c833 Added links to uwsgi.
Ruslan Ermilov <ru@nginx.com>
parents: 1186
diff changeset
165 <link doc="ngx_http_uwsgi_module.xml" id="uwsgi_next_upstream"/>,
1181
b8f0362f61e5 Added links to scgi.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1155
diff changeset
166 <link doc="ngx_http_scgi_module.xml" id="scgi_next_upstream"/>, and
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
167 <link doc="ngx_http_memcached_module.xml" id="memcached_next_upstream"/>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
168 directives.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
169 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
170
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
171 <tag-name id="fail_timeout">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
172 <literal>fail_timeout</literal>=<value>time</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
173 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
174 <tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
175 sets
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
176 <list type="bullet">
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
177
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
178 <listitem>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
179 the time during which the specified number of unsuccessful attempts to
968
fa19bacf6e1e Unified upstream server up/down state terminology.
Vladimir Homutov <vl@nginx.com>
parents: 966
diff changeset
180 communicate with the server should happen to consider the server unavailable;
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
181 </listitem>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
182
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
183 <listitem>
968
fa19bacf6e1e Unified upstream server up/down state terminology.
Vladimir Homutov <vl@nginx.com>
parents: 966
diff changeset
184 and the period of time the server will be considered unavailable.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
185 </listitem>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
186
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
187 </list>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
188 By default, the parameter is set to 10 seconds.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
189 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
190
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
191 <tag-name id="backup">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
192 <literal>backup</literal>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
193 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
194 <tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
195 marks the server as a backup server.
968
fa19bacf6e1e Unified upstream server up/down state terminology.
Vladimir Homutov <vl@nginx.com>
parents: 966
diff changeset
196 It will be passed requests when the primary servers are unavailable.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
197 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
198
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
199 <tag-name id="down">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
200 <literal>down</literal>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
201 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
202 <tag-desc>
1410
f5dcc23b214f Deleted info about hash and ip_hash from the down parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1393
diff changeset
203 marks the server as permanently unavailable.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
204 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
205
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
206 </list>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
207 </para>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
208
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
209 <para>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
210 Additionally,
1128
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
211 the following parameters are available as part of our
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
212 <commercial_version>commercial subscription</commercial_version>:
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
213 <list type="tag">
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
214
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
215 <tag-name id="max_conns">
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
216 <literal>max_conns</literal>=<value>number</value>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
217 </tag-name>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
218 <tag-desc>
1504
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
219 limits the maximum <value>number</value> of simultaneous active
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
220 connections to the proxied server (1.5.9).
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
221 Default value is zero, meaning there is no limit.
1504
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
222 <note>
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
223 When <link id="keepalive"/> connections and multiple
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
224 <link doc="../ngx_core_module.xml" id="worker_processes">workers</link>
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
225 are enabled,
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
226 the total number of connections to the proxied server
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
227 may exceed the <literal>max_conns</literal> value.
0b89d1e54e8f Updated definition of the "max_conns" parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1495
diff changeset
228 </note>
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
229 </tag-desc>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
230
1124
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
231 <tag-name id="resolve">
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
232 <literal>resolve</literal>
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
233 </tag-name>
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
234 <tag-desc>
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
235 monitors changes of the IP addresses
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
236 that correspond to a domain name of the server,
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
237 and automatically modifies the upstream configuration
1127
948c853f5d22 Upstream: improved "server resolve".
Ruslan Ermilov <ru@nginx.com>
parents: 1126
diff changeset
238 without the need of restarting nginx (1.5.12).
1124
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
239 <para>
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
240 In order for this parameter to work,
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
241 the <link doc="ngx_http_core_module.xml" id="resolver"/> directive
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
242 must be specified in the
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
243 <link doc="ngx_http_core_module.xml" id="http"/> block.
1127
948c853f5d22 Upstream: improved "server resolve".
Ruslan Ermilov <ru@nginx.com>
parents: 1126
diff changeset
244 Example:
1124
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
245 <example>
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
246 http {
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
247 resolver 10.0.0.1;
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
248
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
249 upstream u {
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
250 zone ...;
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
251 ...
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
252 server example.com resolve;
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
253 }
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
254 }
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
255 </example>
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
256 </para>
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
257 </tag-desc>
d790333947f4 Upstream: the "resolve" parameter of the "server" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1123
diff changeset
258
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
259 <tag-name id="route">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
260 <literal>route</literal>=<value>string</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
261 </tag-name>
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
262 <tag-desc>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
263 sets the server route name.
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
264 </tag-desc>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
265
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
266 <tag-name id="slow_start">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
267 <literal>slow_start</literal>=<value>time</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
268 </tag-name>
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
269 <tag-desc>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
270 sets the <value>time</value> during which the server will recover its weight
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
271 from zero to a nominal value, when unhealthy server becomes
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
272 <link id="health_check">healthy</link>,
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
273 or when the server becomes available after a period of time
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
274 it was considered <link id="fail_timeout">unavailable</link>.
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
275 Default value is zero, i.e. slow start is disabled.
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
276 </tag-desc>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
277
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
278 </list>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
279 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
280
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
281 <para>
969
7c542520b8f7 Added note about behavior of a single server in an upstream.
Vladimir Homutov <vl@nginx.com>
parents: 968
diff changeset
282 <note>
7c542520b8f7 Added note about behavior of a single server in an upstream.
Vladimir Homutov <vl@nginx.com>
parents: 968
diff changeset
283 If there is only a single server in a group, <literal>max_fails</literal>,
7c542520b8f7 Added note about behavior of a single server in an upstream.
Vladimir Homutov <vl@nginx.com>
parents: 968
diff changeset
284 <literal>fail_timeout</literal> and <literal>slow_start</literal> parameters
7c542520b8f7 Added note about behavior of a single server in an upstream.
Vladimir Homutov <vl@nginx.com>
parents: 968
diff changeset
285 are ignored, and such a server will never be considered unavailable.
7c542520b8f7 Added note about behavior of a single server in an upstream.
Vladimir Homutov <vl@nginx.com>
parents: 968
diff changeset
286 </note>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
287 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
288
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
289 </directive>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
290
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
291
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
292 <directive name="zone">
1495
8d134b482cc3 Documented zone usage with many upstreams.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1481
diff changeset
293 <syntax><value>name</value> [<value>size</value>]</syntax>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
294 <default/>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
295 <context>upstream</context>
1461
4e5cab61e548 Documented status of the zone directive in ngx_http_upstream module.
Vladimir Homutov <vl@nginx.com>
parents: 1450
diff changeset
296 <appeared-in>1.9.0</appeared-in>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
297
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
298 <para>
1123
9a9aa8e9d12c Rephrased the "zone" directive, translated into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1122
diff changeset
299 Defines the <value>name</value> and <value>size</value> of the shared
9a9aa8e9d12c Rephrased the "zone" directive, translated into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1122
diff changeset
300 memory zone that keeps the group’s configuration and run-time state that are
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
301 shared between worker processes.
1495
8d134b482cc3 Documented zone usage with many upstreams.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1481
diff changeset
302 Several groups may share the same zone.
8d134b482cc3 Documented zone usage with many upstreams.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1481
diff changeset
303 In this case, it is enough to specify the <value>size</value> only once.
1461
4e5cab61e548 Documented status of the zone directive in ngx_http_upstream module.
Vladimir Homutov <vl@nginx.com>
parents: 1450
diff changeset
304 </para>
4e5cab61e548 Documented status of the zone directive in ngx_http_upstream module.
Vladimir Homutov <vl@nginx.com>
parents: 1450
diff changeset
305
4e5cab61e548 Documented status of the zone directive in ngx_http_upstream module.
Vladimir Homutov <vl@nginx.com>
parents: 1450
diff changeset
306 <para>
4e5cab61e548 Documented status of the zone directive in ngx_http_upstream module.
Vladimir Homutov <vl@nginx.com>
parents: 1450
diff changeset
307 Additionally,
4e5cab61e548 Documented status of the zone directive in ngx_http_upstream module.
Vladimir Homutov <vl@nginx.com>
parents: 1450
diff changeset
308 as part of our <commercial_version>commercial subscription</commercial_version>,
4e5cab61e548 Documented status of the zone directive in ngx_http_upstream module.
Vladimir Homutov <vl@nginx.com>
parents: 1450
diff changeset
309 such groups allow changing the group membership
1123
9a9aa8e9d12c Rephrased the "zone" directive, translated into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1122
diff changeset
310 or modifying the settings of a particular server
9a9aa8e9d12c Rephrased the "zone" directive, translated into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1122
diff changeset
311 without the need of restarting nginx.
9a9aa8e9d12c Rephrased the "zone" directive, translated into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1122
diff changeset
312 The configuration is accessible via a special location
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
313 handled by
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
314 <link doc="ngx_http_upstream_conf_module.xml" id="upstream_conf"/>.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
315 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
316
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
317 </directive>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
318
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
319
1230
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
320 <directive name="hash">
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
321 <syntax><value>key</value> [<literal>consistent</literal>]</syntax>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
322 <default/>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
323 <context>upstream</context>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
324 <appeared-in>1.7.2</appeared-in>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
325
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
326 <para>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
327 Specifies a load balancing method for a server group
1367
f1e14d87d833 Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1348
diff changeset
328 where the client-server mapping is based on the hashed <value>key</value> value.
1230
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
329 The <value>key</value> can contain text, variables, and their combinations.
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
330 Note that adding or removing a server from the group
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
331 may result in remapping most of the keys to different servers.
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
332 The method is compatible with the
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
333 <link url="http://search.cpan.org/perldoc?Cache%3A%3AMemcached">Cache::Memcached</link>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
334 Perl library.
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
335 </para>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
336
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
337 <para>
1367
f1e14d87d833 Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1348
diff changeset
338 If the <literal>consistent</literal> parameter is specified
1230
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
339 the <link url="http://www.last.fm/user/RJ/journal/2007/04/10/392555/">ketama</link>
1367
f1e14d87d833 Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1348
diff changeset
340 consistent hashing method will be used instead.
1230
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
341 The method ensures that only a few keys
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
342 will be remapped to different servers
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
343 when a server is added to or removed from the group.
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
344 This helps to achieve a higher cache hit ratio for caching servers.
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
345 The method is compatible with the
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
346 <link url="http://search.cpan.org/perldoc?Cache%3A%3AMemcached%3A%3AFast">Cache::Memcached::Fast</link>
1236
def99e640654 Fixed grammar.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1233
diff changeset
347 Perl library with the <value>ketama_points</value> parameter set to 160.
1230
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
348 </para>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
349
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
350 </directive>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
351
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
352
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
353 <directive name="ip_hash">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
354 <syntax/>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
355 <default/>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
356 <context>upstream</context>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
357
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
358 <para>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
359 Specifies that a group should use a load balancing method where requests
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
360 are distributed between servers based on client IP addresses.
542
a9e6a8613534 Documented IPv6 support in ip_hash.
Ruslan Ermilov <ru@nginx.com>
parents: 533
diff changeset
361 The first three octets of the client IPv4 address, or the entire IPv6 address,
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
362 are used as a hashing key.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
363 The method ensures that requests from the same client will always be
968
fa19bacf6e1e Unified upstream server up/down state terminology.
Vladimir Homutov <vl@nginx.com>
parents: 966
diff changeset
364 passed to the same server except when this server is unavailable.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
365 In the latter case client requests will be passed to another server.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
366 Most probably, it will always be the same server as well.
542
a9e6a8613534 Documented IPv6 support in ip_hash.
Ruslan Ermilov <ru@nginx.com>
parents: 533
diff changeset
367 <note>
566
f8148fc88224 Documented 1.2.2 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 542
diff changeset
368 IPv6 addresses are supported starting from versions 1.3.2 and 1.2.2.
542
a9e6a8613534 Documented IPv6 support in ip_hash.
Ruslan Ermilov <ru@nginx.com>
parents: 533
diff changeset
369 </note>
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
370 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
371
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
372 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
373 If one of the servers needs to be temporarily removed, it should
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
374 be marked with the <literal>down</literal> parameter in
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
375 order to preserve the current hashing of client IP addresses.
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
376 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
377
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
378 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
379 Example:
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
380 <example>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
381 upstream backend {
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
382 ip_hash;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
383
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
384 server backend1.example.com;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
385 server backend2.example.com;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
386 server backend3.example.com <emphasis>down</emphasis>;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
387 server backend4.example.com;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
388 }
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
389 </example>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
390 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
391
526
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
392 <para>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
393 <note>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
394 Until versions 1.3.1 and 1.2.2, it was not possible to specify a weight for
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
395 servers using the <literal>ip_hash</literal> load balancing method.
526
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
396 </note>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
397 </para>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
398
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
399 </directive>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
400
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
401
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
402 <directive name="keepalive">
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
403 <syntax><value>connections</value></syntax>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
404 <default/>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
405 <context>upstream</context>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
406 <appeared-in>1.1.4</appeared-in>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
407
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
408 <para>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
409 Activates the cache for connections to upstream servers.
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
410 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
411
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
412 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
413 The <value>connections</value> parameter sets the maximum number of
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
414 idle keepalive connections to upstream servers that are preserved in
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
415 the cache of each worker process.
654
841118e33f41 Refined the text about cache of connections to upstream servers.
Ruslan Ermilov <ru@nginx.com>
parents: 589
diff changeset
416 When this number is exceeded, the least recently used connections
841118e33f41 Refined the text about cache of connections to upstream servers.
Ruslan Ermilov <ru@nginx.com>
parents: 589
diff changeset
417 are closed.
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
418 <note>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
419 It should be particularly noted that the <literal>keepalive</literal> directive
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
420 does not limit the total number of connections to upstream servers
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
421 that an nginx worker process can open.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
422 The <value>connections</value> parameter should be set to a number small enough
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
423 to let upstream servers process new incoming connections as well.
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
424 </note>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
425 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
426
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
427 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
428 Example configuration of memcached upstream with keepalive connections:
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
429 <example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
430 upstream memcached_backend {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
431 server 127.0.0.1:11211;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
432 server 10.0.0.2:11211;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
433
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
434 keepalive 32;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
435 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
436
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
437 server {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
438 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
439
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
440 location /memcached/ {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
441 set $memcached_key $uri;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
442 memcached_pass memcached_backend;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
443 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
444
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
445 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
446 </example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
447 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
448
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
449 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
450 For HTTP, the <link doc="ngx_http_proxy_module.xml" id="proxy_http_version"/>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
451 directive should be set to “<literal>1.1</literal>”
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
452 and the <header>Connection</header> header field should be cleared:
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
453 <example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
454 upstream http_backend {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
455 server 127.0.0.1:8080;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
456
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
457 keepalive 16;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
458 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
459
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
460 server {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
461 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
462
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
463 location /http/ {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
464 proxy_pass http://http_backend;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
465 proxy_http_version 1.1;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
466 proxy_set_header Connection "";
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
467 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
468 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
469 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
470 </example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
471 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
472
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
473 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
474 <note>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
475 Alternatively, HTTP/1.0 persistent connections can be used by passing the
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
476 <header>Connection: Keep-Alive</header> header field to an upstream server,
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
477 though this method is not recommended.
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
478 </note>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
479 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
480
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
481 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
482 For FastCGI servers, it is required to set
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
483 <link doc="ngx_http_fastcgi_module.xml" id="fastcgi_keep_conn"/>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
484 for keepalive connections to work:
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
485 <example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
486 upstream fastcgi_backend {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
487 server 127.0.0.1:9000;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
488
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
489 keepalive 8;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
490 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
491
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
492 server {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
493 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
494
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
495 location /fastcgi/ {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
496 fastcgi_pass fastcgi_backend;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
497 fastcgi_keep_conn on;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
498 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
499 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
500 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
501 </example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
502 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
503
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
504 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
505 <note>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
506 When using load balancer methods other than the default
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
507 round-robin method, it is necessary to activate them before
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
508 the <literal>keepalive</literal> directive.
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
509 </note>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
510
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
511 <note>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
512 SCGI and uwsgi protocols do not have a notion of keepalive connections.
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
513 </note>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
514 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
515
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
516 </directive>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
517
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
518
1561
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
519 <directive name="ntlm">
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
520 <syntax/>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
521 <default/>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
522 <context>upstream</context>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
523 <appeared-in>1.9.2</appeared-in>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
524
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
525 <para>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
526 Allows proxying requests with
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
527 <link url="https://en.wikipedia.org/wiki/Integrated_Windows_Authentication">NTLM
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
528 Authentication</link>.
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
529 The upstream connection is bound to the client connection
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
530 once the client sends a request with the <header>Authorization</header>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
531 header field value
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
532 starting with “<literal>Negotiate</literal>” or “<literal>NTLM</literal>”.
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
533 Further client requests will be proxied through the same upstream connection,
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
534 keeping the authentication context.
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
535 </para>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
536
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
537 <para>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
538 <note>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
539 This directive is available as part of our
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
540 <commercial_version>commercial subscription</commercial_version>.
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
541 </note>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
542 </para>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
543
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
544 </directive>
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
545
ed420c318557 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1544
diff changeset
546
526
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
547 <directive name="least_conn">
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
548 <syntax/>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
549 <default/>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
550 <context>upstream</context>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
551 <appeared-in>1.3.1</appeared-in>
566
f8148fc88224 Documented 1.2.2 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 542
diff changeset
552 <appeared-in>1.2.2</appeared-in>
526
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
553
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
554 <para>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
555 Specifies that a group should use a load balancing method where a request
526
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
556 is passed to the server with the least number of active connections,
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
557 taking into account weights of servers.
1232
ab2ea38f3512 Upstream: least_conn description corresponds to the Russian text.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1230
diff changeset
558 If there are several such servers, they are tried in turn using a
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
559 weighted round-robin balancing method.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
560 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
561
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
562 </directive>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
563
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
564
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
565 <directive name="least_time">
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
566 <syntax><literal>header</literal> | <literal>last_byte</literal></syntax>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
567 <default/>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
568 <context>upstream</context>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
569 <appeared-in>1.7.10</appeared-in>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
570
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
571 <para>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
572 Specifies that a group should use a load balancing method where a request
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
573 is passed to the server with the least average response time and
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
574 least number of active connections, taking into account weights of servers.
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
575 If there are several such servers, they are tried in turn using a
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
576 weighted round-robin balancing method.
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
577 </para>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
578
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
579 <para>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
580 If the <literal>header</literal> parameter is specified,
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
581 time to receive the
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
582 <link id="var_upstream_header_time">response header</link> is used.
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
583 If the <literal>last_byte</literal> parameter is specified,
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
584 time to receive the <link id="var_upstream_response_time">full response</link>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
585 is used.
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
586 </para>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
587
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
588 <para>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
589 <note>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
590 This directive is available as part of our
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
591 <commercial_version>commercial subscription</commercial_version>.
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
592 </note>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
593 </para>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
594
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
595 </directive>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
596
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
597
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
598 <directive name="health_check">
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
599 <syntax>[<value>parameters</value>]</syntax>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
600 <default/>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
601 <context>location</context>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
602
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
603 <para>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
604 Enables periodic health checks of the servers in a
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
605 <link id="upstream">group</link> referenced in the surrounding location.
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
606 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
607
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
608 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
609 The following optional parameters are supported:
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
610 <list type="tag">
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
611
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
612 <tag-name id="interval">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
613 <literal>interval</literal>=<value>time</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
614 </tag-name>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
615 <tag-desc>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
616 sets the interval between two consecutive health checks,
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
617 by default, 5 seconds;
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
618 </tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
619
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
620 <tag-name id="fails">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
621 <literal>fails</literal>=<value>number</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
622 </tag-name>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
623 <tag-desc>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
624 sets the number of consecutive failed health checks of a particular server
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
625 after which this server will be considered unhealthy,
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
626 by default, 1;
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
627 </tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
628
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
629 <tag-name id="passes">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
630 <literal>passes</literal>=<value>number</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
631 </tag-name>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
632 <tag-desc>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
633 sets the number of consecutive passed health checks of a particular server
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
634 after which the server will be considered healthy,
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
635 by default, 1;
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
636 </tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
637
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
638 <tag-name id="uri">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
639 <literal>uri</literal>=<value>uri</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
640 </tag-name>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
641 <tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
642 defines the URI used in health check requests,
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
643 by default, “<literal>/</literal>”;
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
644 </tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
645
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
646 <tag-name id="hc_match">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
647 <literal>match</literal>=<value>name</value>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
648 </tag-name>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
649 <tag-desc>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
650 specifies the <literal>match</literal> block configuring the tests that a
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
651 response should pass in order for a health check to pass;
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
652 by default, the response should have status code 2xx or 3xx.
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
653 </tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
654
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
655 </list>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
656 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
657
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
658 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
659 For example,
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
660 <example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
661 location / {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
662 proxy_pass http://backend;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
663 health_check;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
664 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
665 </example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
666 will send “<literal>/</literal>” requests to each
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
667 server in the <literal>backend</literal> group every five seconds.
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
668 If any communication error or timeout occurs, or a
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
669 proxied server responds with the status code other than
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
670 2xx or 3xx, the health check will fail, and the server will
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
671 be considered unhealthy.
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
672 Client requests are not passed to unhealthy servers.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
673 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
674
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
675 <para>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
676 Health checks can be configured to test the status code of a response,
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
677 presence of certain header fields and their values,
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
678 and the body contents.
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
679 Tests are configured separately using the <link id="match"/> directive
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
680 and referenced in the <literal>match</literal> parameter.
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
681 For example:
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
682 <example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
683 http {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
684 server {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
685 ...
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
686 location / {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
687 proxy_pass http://backend;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
688 health_check match=welcome;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
689 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
690 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
691
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
692 match welcome {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
693 status 200;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
694 header Content-Type = text/html;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
695 body ~ "Welcome to nginx!";
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
696 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
697 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
698 </example>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
699 This configuration tells that for a health check to pass, the response to a
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
700 health check request should succeed,
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
701 have status 200, content type “<literal>text/html</literal>”,
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
702 and contain “<literal>Welcome to nginx!</literal>” in the body.
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
703 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
704
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
705 <para>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
706 The server group must reside in the <link id="zone">shared memory</link>.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
707 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
708
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
709 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
710 If several health checks are defined for the same group of servers,
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
711 a single failure of any check will make the corresponding server be
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
712 considered unhealthy.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
713 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
714
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
715 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
716 <note>
1348
5e45198fa991 Documented that with health checks most variables are useless.
Ruslan Ermilov <ru@nginx.com>
parents: 1259
diff changeset
717 Please note that most of the variables will have empty values
5e45198fa991 Documented that with health checks most variables are useless.
Ruslan Ermilov <ru@nginx.com>
parents: 1259
diff changeset
718 when used with health checks.
5e45198fa991 Documented that with health checks most variables are useless.
Ruslan Ermilov <ru@nginx.com>
parents: 1259
diff changeset
719 </note>
5e45198fa991 Documented that with health checks most variables are useless.
Ruslan Ermilov <ru@nginx.com>
parents: 1259
diff changeset
720 </para>
5e45198fa991 Documented that with health checks most variables are useless.
Ruslan Ermilov <ru@nginx.com>
parents: 1259
diff changeset
721
5e45198fa991 Documented that with health checks most variables are useless.
Ruslan Ermilov <ru@nginx.com>
parents: 1259
diff changeset
722 <para>
5e45198fa991 Documented that with health checks most variables are useless.
Ruslan Ermilov <ru@nginx.com>
parents: 1259
diff changeset
723 <note>
1128
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
724 This directive is available as part of our
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
725 <commercial_version>commercial subscription</commercial_version>.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
726 </note>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
727 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
728
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
729 </directive>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
730
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
731
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
732 <directive name="match">
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
733 <syntax block="yes"><value>name</value></syntax>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
734 <default/>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
735 <context>http</context>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
736
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
737 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
738 Defines the named test set used to verify responses to health check requests.
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
739 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
740
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
741 <para>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
742 The following items can be tested in a response:
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
743 <list type="tag">
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
744
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
745 <tag-name><literal>status 200;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
746 <tag-desc>status is 200</tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
747
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
748 <tag-name><literal>status ! 500;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
749 <tag-desc>status is not 500</tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
750
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
751 <tag-name><literal>status 200 204;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
752 <tag-desc>status is 200 or 204</tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
753
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
754 <tag-name><literal>status ! 301 302;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
755 <tag-desc>status is neither 301 nor 302</tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
756
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
757 <tag-name><literal>status 200-399;</literal></tag-name>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
758 <tag-desc>status is in the range from 200 to 399</tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
759
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
760 <tag-name><literal>status ! 400-599;</literal></tag-name>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
761 <tag-desc>status is not in the range from 400 to 599</tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
762
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
763 <tag-name><literal>status 301-303 307;</literal></tag-name>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
764 <tag-desc>status is either 301, 302, 303, or 307</tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
765
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
766 </list>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
767
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
768 <list type="tag">
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
769
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
770 <tag-name><literal>header Content-Type = text/html;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
771 <tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
772 header contains <header>Content-Type</header>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
773 with value <literal>text/html</literal>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
774 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
775
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
776 <tag-name><literal>header Content-Type != text/html;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
777 <tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
778 header contains <header>Content-Type</header>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
779 with value other than <literal>text/html</literal>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
780 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
781
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
782 <tag-name><literal>header Connection ~ close;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
783 <tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
784 header contains <header>Connection</header>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
785 with value matching regular expression <literal>close</literal>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
786 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
787
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
788 <tag-name><literal>header Connection !~ close;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
789 <tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
790 header contains <header>Connection</header>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
791 with value not matching regular expression <literal>close</literal>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
792 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
793
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
794 <tag-name><literal>header Host;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
795 <tag-desc>header contains <header>Host</header></tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
796
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
797 <tag-name><literal>header ! X-Accel-Redirect;</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
798 <tag-desc>header lacks <header>X-Accel-Redirect</header></tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
799
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
800 </list>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
801
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
802 <list type="tag">
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
803
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
804 <tag-name><literal>body ~ "Welcome to nginx!";</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
805 <tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
806 body matches regular expression “<literal>Welcome to nginx!</literal>”
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
807 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
808
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
809 <tag-name><literal>body !~ "Welcome to nginx!";</literal></tag-name>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
810 <tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
811 body does not match regular expression “<literal>Welcome to nginx!</literal>”
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
812 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
813
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
814 </list>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
815 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
816
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
817 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
818 If several tests are specified,
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
819 the response matches only if it matches all tests.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
820 <note>
956
488a3f738db0 Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 955
diff changeset
821 Only the first 256k of the response body are examined.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
822 </note>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
823 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
824
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
825 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
826 Examples:
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
827 <example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
828 # status is 200, content type is "text/html",
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
829 # and body contains "Welcome to nginx!"
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
830 match welcome {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
831 status 200;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
832 header Content-Type = text/html;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
833 body ~ "Welcome to nginx!";
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
834 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
835 </example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
836
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
837 <example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
838 # status is not one of 301, 302, 303, or 307, and header does not have "Refresh:"
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
839 match not_redirect {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
840 status ! 301-303 307;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
841 header ! Refresh;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
842 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
843 </example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
844
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
845 <example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
846 # status ok and not in maintenance mode
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
847 match server_ok {
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
848 status 200-399;
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
849 body !~ "maintenance mode";
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
850 }
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
851 </example>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
852
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
853 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
854
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
855 <para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
856 <note>
1128
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
857 This directive is available as part of our
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
858 <commercial_version>commercial subscription</commercial_version>.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
859 </note>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
860 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
861
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
862 </directive>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
863
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
864
1125
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
865 <directive name="queue">
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
866 <syntax>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
867 <value>number</value>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
868 [<literal>timeout</literal>=<value>time</value>]</syntax>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
869 <default/>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
870 <context>upstream</context>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
871 <appeared-in>1.5.12</appeared-in>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
872
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
873 <para>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
874 If an upstream server cannot be selected immediately
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
875 while processing a request,
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
876 and there are the servers in the group that have reached the
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
877 <link id="max_conns"/> limit,
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
878 the request will be placed into the queue.
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
879 The directive specifies the maximum number of requests that can be in the queue
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
880 at the same time.
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
881 If the queue is filled up,
1543
08242a0abf11 Fixed grammar in the upstream queue directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1504
diff changeset
882 or the server to pass the request to cannot be selected within
1125
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
883 the time period specified in the <literal>timeout</literal> parameter,
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
884 an error will be returned to the client.
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
885 </para>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
886
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
887 <para>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
888 The default value of the <literal>timeout</literal> parameter is 60 seconds.
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
889 </para>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
890
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
891 <para>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
892 <note>
1128
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
893 This directive is available as part of our
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
894 <commercial_version>commercial subscription</commercial_version>.
1125
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
895 </note>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
896 </para>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
897
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
898 </directive>
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
899
9a95b9026a16 Upstream: reallocated the "queue" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1124
diff changeset
900
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
901 <directive name="sticky">
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
902 <syntax>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
903 <literal>cookie</literal> <value>name</value>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
904 [<literal>expires=</literal><value>time</value>]
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
905 [<literal>domain=</literal><value>domain</value>]
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
906 [<literal>httponly</literal>]
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
907 [<literal>secure</literal>]
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
908 [<literal>path=</literal><value>path</value>]</syntax>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
909 <syntax>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
910 <literal>route</literal> <value>$variable</value> ...</syntax>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
911 <syntax>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
912 <literal>learn</literal>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
913 <literal>create=</literal><value>$variable</value>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
914 <literal>lookup=</literal><value>$variable</value>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
915 <literal>zone=</literal><value>name</value>:<value>size</value>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
916 [<literal>timeout=</literal><value>time</value>]</syntax>
987
edd505634357 Documented the "sticky" directive.
Vladimir Homutov <vl@nginx.com>
parents: 981
diff changeset
917 <default/>
edd505634357 Documented the "sticky" directive.
Vladimir Homutov <vl@nginx.com>
parents: 981
diff changeset
918 <context>upstream</context>
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
919 <appeared-in>1.5.7</appeared-in>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
920
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
921 <para>
962
f3754c623e6b Minor editing of the stiky_cookie_insert directive.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 960
diff changeset
922 Enables session affinity, which causes requests from the same client to be
960
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
923 passed to the same server in a group of servers.
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
924 Three methods are available:
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
925 <list type="tag">
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
926 <tag-name id="sticky_cookie"><literal>cookie</literal></tag-name>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
927 <tag-desc>
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
928
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
929 <para>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
930 When the <literal>cookie</literal> method is used, information about the
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
931 designated server is passed in an HTTP cookie generated by nginx:
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
932 <example>
960
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
933 upstream backend {
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
934 server backend1.example.com;
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
935 server backend2.example.com;
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
936
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
937 sticky cookie srv_id expires=1h domain=.example.com path=/;
960
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
938 }
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
939 </example>
960
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
940 </para>
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
941
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
942 <para>
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
943 A request that comes from a client not yet bound to a particular server
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
944 is passed to the server selected by the configured balancing method.
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
945 Further requests with this cookie will be passed to the designated server.
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
946 If the designated server cannot process a request, the new server is
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
947 selected as if the client has not been bound yet.
960
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
948 </para>
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
949
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
950 <para>
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
951 The first parameter sets the name of the cookie to be set or inspected.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
952 Additional parameters may be as follows:
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
953 <list type="tag">
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
954
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
955 <tag-name><literal>expires=</literal><value>time</value></tag-name>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
956 <tag-desc>
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
957 Sets the <value>time</value> for which a browser should keep the cookie.
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
958 The special value <literal>max</literal> will cause the cookie to expire on
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
959 “<literal>31 Dec 2037 23:55:55 GMT</literal>”.
960
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
960 If the parameter is not specified, it will cause the cookie to expire at
48ab154edf10 Upstream: removed obsoleted directives in the "sticky" module.
Vladimir Homutov <vl@nginx.com>
parents: 956
diff changeset
961 the end of a browser session.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
962 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
963
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
964 <tag-name><literal>domain=</literal><value>domain</value></tag-name>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
965 <tag-desc>
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
966 Defines the <value>domain</value> for which the cookie is set.
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
967 </tag-desc>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
968
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
969 <tag-name><literal>httponly</literal></tag-name>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
970 <tag-desc>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
971 Adds the <literal>HttpOnly</literal> attribute to the cookie (1.7.11).
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
972 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
973
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
974 <tag-name><literal>secure</literal></tag-name>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
975 <tag-desc>
1450
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
976 Adds the <literal>Secure</literal> attribute to the cookie (1.7.11).
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
977
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
978 </tag-desc>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
979
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
980 <tag-name><literal>path=</literal><value>path</value></tag-name>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
981 <tag-desc>
f5b5eefc43cb Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1424
diff changeset
982 Defines the <value>path</value> for which the cookie is set.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
983 </tag-desc>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
984
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
985 </list>
981
fc35441b4856 Fixed grammar.
Vladimir Homutov <vl@nginx.com>
parents: 969
diff changeset
986 If any parameters are omitted, the corresponding cookie fields are not set.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
987 </para>
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
988 </tag-desc>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
989
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
990 <tag-name id="sticky_route"><literal>route</literal></tag-name>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
991 <tag-desc>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
992
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
993 <para>
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
994 When the <literal>route</literal> method is used, proxied server assigns
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
995 client a route on receipt of the first request.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
996 All subsequent requests from this client will carry routing information
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
997 in a cookie or URI.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
998 This information is compared with the “<literal>route</literal>” parameter
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
999 of the <link id="server"/> directive to identify the server to which the
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1000 request should be proxied.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1001 If the designated server cannot process a request, the new server is
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1002 selected by the configured balancing method as if there is no routing
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1003 information in the request.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1004 </para>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1005
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1006 <para>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1007 The parameters of the <literal>route</literal> method specify variables that
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1008 may contain routing information.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1009 The first non-empty variable is used to find the matching server.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1010 </para>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1011
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1012 <para>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1013 Example:
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1014 <example>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1015 map $cookie_jsessionid $route_cookie {
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1016 ~.+\.(?P&lt;route>\w+)$ $route;
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1017 }
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1018
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1019 map $request_uri $route_uri {
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1020 ~jsessionid=.+\.(?P&lt;route>\w+)$ $route;
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1021 }
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1022
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1023 upstream backend {
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1024 server backend1.example.com route=a;
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1025 server backend2.example.com route=b;
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1027 sticky route $route_cookie $route_uri;
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1028 }
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1029 </example>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1030 Here, the route is taken from the “<literal>JSESSIONID</literal>” cookie
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1031 if present in a request.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1032 Otherwise, the route from the URI is used.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1033 </para>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1034
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1035 </tag-desc>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1036
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1037 <tag-name id="sticky_learn"><literal>learn</literal></tag-name>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1038 <tag-desc>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1039 <para>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1040 When the <literal>learn</literal> method (1.7.1) is used, nginx
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1041 analyzes upstream server responses and learns server-initiated sessions
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1042 usually passed in an HTTP cookie.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1043 <example>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1044 upstream backend {
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1045 server backend1.example.com:8080;
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1046 server backend2.example.com:8081;
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1047
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1048 sticky learn
1544
627a9309011c Renamed cookie in the example of the sticky directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1543
diff changeset
1049 create=$upstream_cookie_examplecookie
627a9309011c Renamed cookie in the example of the sticky directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1543
diff changeset
1050 lookup=$cookie_examplecookie
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1051 zone=client_sessions:1m;
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1052 }
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1053 </example>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1054
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1055 In the example, the upstream server creates a session by setting the
1544
627a9309011c Renamed cookie in the example of the sticky directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1543
diff changeset
1056 cookie “<literal>EXAMPLECOOKIE</literal>” in the response.
1259
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1057 Further requests with this cookie will be passed to the same server.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1058 If the server cannot process the request, the new server is
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1059 selected as if the client has not been bound yet.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1060 </para>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1061
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1062 <para>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1063 The parameters <literal>create</literal> and <literal>lookup</literal>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1064 specify variables that indicate how new sessions are created and existing
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1065 sessions are searched, respectively.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1066 Both parameters may be specified more than once, in which case the first
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1067 non-empty variable is used.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1068 </para>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1069
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1070 <para>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1071 Sessions are stored in a shared memory zone, whose <value>name</value> and
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1072 <value>size</value> are configured by the <literal>zone</literal> parameter.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1073 One megabyte zone can store about 8000 sessions on the 64-bit platform.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1074 The sessions that are not accessed during the time specified by the
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1075 <literal>timeout</literal> parameter get removed from the zone.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1076 By default, <literal>timeout</literal> is set to 10 minutes.
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1077 </para>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1078
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1079 </tag-desc>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1080 </list>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1081 </para>
954dcc02cb63 Upstream: "session learn" sticky method and upstream_conf changes.
Ruslan Ermilov <ru@nginx.com>
parents: 1241
diff changeset
1082
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1083 <para>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
1084 <note>
1128
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
1085 This directive is available as part of our
1594ed379f1f De-i18n'ed <commercial_version/>.
Ruslan Ermilov <ru@nginx.com>
parents: 1127
diff changeset
1086 <commercial_version>commercial subscription</commercial_version>.
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
1087 </note>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
1088 </para>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
1089
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
1090 </directive>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
1091
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
1092
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1093 <directive name="sticky_cookie_insert">
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1094 <syntax><value>name</value>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1095 [<literal>expires=</literal><value>time</value>]
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1096 [<literal>domain=</literal><value>domain</value>]
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1097 [<literal>path=</literal><value>path</value>]</syntax>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1098 <default/>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1099 <context>upstream</context>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1100
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1101 <para>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1102 This directive is obsolete since version 1.5.7.
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1103 An equivalent
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1104 <link id="sticky"/> directive with a new syntax should be used instead:
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1105 <note>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1106 <literal>sticky cookie</literal> <value>name</value>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1107 [<literal>expires=</literal><value>time</value>]
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1108 [<literal>domain=</literal><value>domain</value>]
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1109 [<literal>path=</literal><value>path</value>];
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1110 </note>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1111 </para>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1112
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1113 </directive>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
1114
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1115 </section>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1116
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1117
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1118 <section id="variables" name="Embedded Variables">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1119
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1120 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1121 The <literal>ngx_http_upstream_module</literal> module
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1122 supports the following embedded variables:
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1123 <list type="tag">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1124
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
1125 <tag-name id="var_upstream_addr"><var>$upstream_addr</var></tag-name>
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1126 <tag-desc>
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1127 keeps the IP address and port,
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1128 or the path to the UNIX-domain socket of the upstream server.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1129 If several servers were contacted during request processing,
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1130 their addresses are separated by commas, e.g.
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1131 “<literal>192.168.1.1:80, 192.168.1.2:80, unix:/tmp/sock</literal>”.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
1132 If an internal redirect from one server group to another happens,
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
1133 initiated by
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1134 <header>X-Accel-Redirect</header> or
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
1135 <link doc="ngx_http_core_module.xml" id="error_page"/>,
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
1136 then the server addresses from different groups are separated by colons, e.g.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1137 “<literal>192.168.1.1:80, 192.168.1.2:80, unix:/tmp/sock : 192.168.10.1:80, 192.168.10.2:80</literal>”.
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1138 </tag-desc>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1139
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
1140 <tag-name id="var_upstream_cache_status"><var>$upstream_cache_status</var>
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
1141 </tag-name>
731
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
1142 <tag-desc>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
1143 keeps the status of accessing a response cache (0.8.3).
1075
6c021feec587 Removed unjustified non-breakable spaces.
Ruslan Ermilov <ru@nginx.com>
parents: 1026
diff changeset
1144 The status can be either “<literal>MISS</literal>”,
731
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
1145 “<literal>BYPASS</literal>”, “<literal>EXPIRED</literal>”,
1011
2ad2f30efdf2 Documented the "fastcgi_" and "proxy_cache_revalidate" directives.
Vladimir Homutov <vl@nginx.com>
parents: 1003
diff changeset
1146 “<literal>STALE</literal>”, “<literal>UPDATING</literal>”,
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1147 “<literal>REVALIDATED</literal>”, or “<literal>HIT</literal>”.
731
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
1148 </tag-desc>
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
1149
1481
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1150 <tag-name id="var_upstream_connect_time"><var>$upstream_connect_time</var>
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1151 </tag-name>
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1152 <tag-desc>
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1153 keeps time spent on establishing a connection with the upstream server (1.9.1);
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1154 the time is kept in seconds with millisecond resolution.
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1155 In case of SSL, includes time spent on handshake.
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1156 Times of several connections
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1157 are separated by commas and colons like addresses in the
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1158 <link id="var_upstream_addr">$upstream_addr</link> variable.
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1159 </tag-desc>
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
1160
1186
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
1161 <tag-name id="var_upstream_cookie_"><var>$upstream_cookie_</var><value>name</value>
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
1162 </tag-name>
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
1163 <tag-desc>
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
1164 cookie with the specified <value>name</value> sent by the upstream server
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
1165 in the <header>Set-Cookie</header> response header field (1.7.1).
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1166 Only the cookies from the response of the last server are saved.
1186
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
1167 </tag-desc>
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
1168
1393
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1169 <tag-name id="var_upstream_header_time"><var>$upstream_header_time</var>
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1170 </tag-name>
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1171 <tag-desc>
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1172 keeps time
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1173 spent on receiving the response header from the upstream server (1.7.10);
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1174 the time is kept in seconds with millisecond resolution.
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1175 Times of several responses
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1176 are separated by commas and colons like addresses in the
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1177 <link id="var_upstream_addr">$upstream_addr</link> variable.
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1178 </tag-desc>
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
1179
1392
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1180 <tag-name id="var_upstream_http_"><var>$upstream_http_</var><value>name</value></tag-name>
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1181 <tag-desc>
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1182 keep server response header fields.
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1183 For example, the <header>Server</header> response header field
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1184 is available through the <var>$upstream_http_server</var> variable.
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1185 The rules of converting header field names to variable names are the same
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1186 as for the variables that start with the
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1187 “<link doc="ngx_http_core_module.xml" id="var_http_">$http_</link>” prefix.
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1188 Only the header fields from the response of the last server are saved.
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1189 </tag-desc>
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
1190
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
1191 <tag-name id="var_upstream_response_length"><var>$upstream_response_length</var>
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
1192 </tag-name>
731
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
1193 <tag-desc>
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1194 keeps the length of the response obtained from the upstream server (0.7.27);
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1195 the length is kept in bytes.
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1196 Lengths of several responses
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1197 are separated by commas and colons like addresses in the
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1198 <link id="var_upstream_addr">$upstream_addr</link> variable.
731
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
1199 </tag-desc>
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
1200
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
1201 <tag-name id="var_upstream_response_time"><var>$upstream_response_time</var>
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
1202 </tag-name>
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1203 <tag-desc>
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1204 keeps time spent on receiving the response from the upstream server;
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1205 the time is kept in seconds with millisecond resolution.
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1206 Times of several responses
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1207 are separated by commas and colons like addresses in the
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1208 <link id="var_upstream_addr">$upstream_addr</link> variable.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1209 </tag-desc>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1210
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
1211 <tag-name id="var_upstream_status"><var>$upstream_status</var></tag-name>
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1212 <tag-desc>
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1213 keeps status code of the response obtained from the upstream server.
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1214 Status codes of several responses
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1215 are separated by commas and colons like addresses in the
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
1216 <link id="var_upstream_addr">$upstream_addr</link> variable.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1217 </tag-desc>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1218
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1219 </list>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1220 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1221
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1222 </section>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1223
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1224 </module>