annotate xml/en/docs/http/ngx_http_upstream_module.xml @ 3090:27532d42102b default tip

Documented the "rate" parameter of the "error_log" directive.
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 16 Jun 2024 06:55:30 +0300
parents 0bbf14c9fd66
children
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"
3084
0bbf14c9fd66 Documented $upstream_cache_key.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3043
diff changeset
13 rev="90">
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"/>,
2134
4cafd82e5007 Added info about gRPC to various modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2113
diff changeset
23 <link doc="ngx_http_scgi_module.xml" id="scgi_pass"/>,
4cafd82e5007 Added info about gRPC to various modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2113
diff changeset
24 <link doc="ngx_http_memcached_module.xml" id="memcached_pass"/>, and
4cafd82e5007 Added info about gRPC to various modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2113
diff changeset
25 <link doc="ngx_http_grpc_module.xml" id="grpc_pass"/> directives.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
26 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
27
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
28 </section>
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
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
31 <section id="example" name="Example Configuration">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
32
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
33 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
34 <example>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
35 upstream <emphasis>backend</emphasis> {
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
36 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
37 server backend2.example.com:8080;
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
38 server unix:/tmp/backend3;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
39
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
40 server backup1.example.com:8080 backup;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
41 server backup2.example.com:8080 backup;
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
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
44 server {
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
45 location / {
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
46 proxy_pass http://<emphasis>backend</emphasis>;
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 }
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
49 </example>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
50 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
51
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
52 </section>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
53
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
54
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
55 <section id="directives" name="Directives">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
56
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
57 <directive name="upstream">
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
58 <syntax block="yes"><value>name</value></syntax>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
59 <default/>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
60 <context>http</context>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
61
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
62 <para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
63 Defines a group of servers.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
64 Servers can listen on different ports.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
65 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
66 can be mixed.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
67 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
68
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
69 <para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
70 Example:
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
71 <example>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
72 upstream backend {
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
73 server backend1.example.com weight=5;
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
74 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
75 server unix:/tmp/backend3;
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
76
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
77 server backup1.example.com backup;
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
78 }
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
79 </example>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
80 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
81
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
82 <para>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
83 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
84 weighted round-robin balancing method.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
85 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
86 5 requests go to <literal>backend1.example.com</literal>
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
87 and one request to each of the second and third servers.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
88 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
89 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
90 servers will be tried.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
91 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
92 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
93 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
94
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
95 </directive>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
96
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
97
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
98 <directive name="server">
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
99 <syntax><value>address</value> [<value>parameters</value>]</syntax>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
100 <default/>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
101 <context>upstream</context>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
102
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
103 <para>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
104 Defines the <value>address</value> and other <value>parameters</value>
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
105 of a server.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
106 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
107 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
108 specified after the “<literal>unix:</literal>” prefix.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
109 If a port is not specified, the port 80 is used.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
110 A domain name that resolves to several IP addresses defines
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
111 multiple servers at once.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
112 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
113
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
114 <para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
115 The following parameters can be defined:
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
116 <list type="tag">
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
117
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
118 <tag-name id="weight">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
119 <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
120 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
121 <tag-desc>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
122 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
123 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
124
1800
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
125 <tag-name id="max_conns">
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
126 <literal>max_conns</literal>=<value>number</value>
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
127 </tag-name>
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
128 <tag-desc>
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
129 limits the maximum <value>number</value> of simultaneous active
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
130 connections to the proxied server (1.11.5).
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
131 Default value is zero, meaning there is no limit.
1801
592f9fa804f6 Added info about shared memory to max_conns.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1800
diff changeset
132 If the server group does not reside in the <link id="zone">shared memory</link>,
592f9fa804f6 Added info about shared memory to max_conns.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1800
diff changeset
133 the limitation works per each worker process.
1800
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
134 <note>
1801
592f9fa804f6 Added info about shared memory to max_conns.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1800
diff changeset
135 If <link id="keepalive">idle keepalive</link> connections,
592f9fa804f6 Added info about shared memory to max_conns.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1800
diff changeset
136 multiple <link doc="../ngx_core_module.xml" id="worker_processes">workers</link>,
592f9fa804f6 Added info about shared memory to max_conns.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1800
diff changeset
137 and the <link id="zone">shared memory</link> are enabled,
592f9fa804f6 Added info about shared memory to max_conns.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1800
diff changeset
138 the total number of active and idle connections to the proxied server
1800
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
139 may exceed the <literal>max_conns</literal> value.
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
140 </note>
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
141 </tag-desc>
9d722e4153ab Documented the "max_conns" parameter as opensource.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1783
diff changeset
142
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
143 <tag-name id="max_fails">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
144 <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
145 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
146 <tag-desc>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
147 sets the number of unsuccessful attempts to communicate with the server
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
148 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
149 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
150 <literal>fail_timeout</literal> parameter.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
151 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
152 The zero value disables the accounting of attempts.
942
ba3d6ade3513 Elaborate on upstream server failures.
Ruslan Ermilov <ru@nginx.com>
parents: 917
diff changeset
153 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
154 <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
155 <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
156 <link doc="ngx_http_uwsgi_module.xml" id="uwsgi_next_upstream"/>,
2134
4cafd82e5007 Added info about gRPC to various modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2113
diff changeset
157 <link doc="ngx_http_scgi_module.xml" id="scgi_next_upstream"/>,
4cafd82e5007 Added info about gRPC to various modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2113
diff changeset
158 <link doc="ngx_http_memcached_module.xml" id="memcached_next_upstream"/>, and
4cafd82e5007 Added info about gRPC to various modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2113
diff changeset
159 <link doc="ngx_http_grpc_module.xml" id="grpc_next_upstream"/>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
160 directives.
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
161 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
162
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
163 <tag-name id="fail_timeout">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
164 <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
165 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
166 <tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
167 sets
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
168 <list type="bullet">
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
169
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
170 <listitem>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
171 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
172 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
173 </listitem>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
174
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
175 <listitem>
968
fa19bacf6e1e Unified upstream server up/down state terminology.
Vladimir Homutov <vl@nginx.com>
parents: 966
diff changeset
176 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
177 </listitem>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
178
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
179 </list>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
180 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
181 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
182
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
183 <tag-name id="backup">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
184 <literal>backup</literal>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
185 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
186 <tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
187 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
188 It will be passed requests when the primary servers are unavailable.
2434
a1f61586779b Listed not supported load balancing methods in upstream backup.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2418
diff changeset
189 <note>
a1f61586779b Listed not supported load balancing methods in upstream backup.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2418
diff changeset
190 The parameter cannot be used along with the
a1f61586779b Listed not supported load balancing methods in upstream backup.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2418
diff changeset
191 <link id="hash"/>, <link id="ip_hash"/>, and <link id="random"/>
a1f61586779b Listed not supported load balancing methods in upstream backup.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2418
diff changeset
192 load balancing methods.
a1f61586779b Listed not supported load balancing methods in upstream backup.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2418
diff changeset
193 </note>
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
1241
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
196 <tag-name id="down">
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
197 <literal>down</literal>
2246339a6a93 Upstream: added IDs for "server" and "health_check" params.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1236
diff changeset
198 </tag-name>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
199 <tag-desc>
1410
f5dcc23b214f Deleted info about hash and ip_hash from the down parameter.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1393
diff changeset
200 marks the server as permanently unavailable.
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
201 </tag-desc>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
202
1126
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
203 </list>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
204 </para>
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
205
2e28d1c4a0a2 Upstream: revised layout of the "server" directive.
Ruslan Ermilov <ru@nginx.com>
parents: 1125
diff changeset
206 <para>
1817
0160e8784417 Documented behavior of server slow_start with ip_hash and hash.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1809
diff changeset
207 <note>
3043
9eadb98ec770 Free nginx: removed commercial version documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3029
diff changeset
208 If there is only a single server in a group,
9eadb98ec770 Free nginx: removed commercial version documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3029
diff changeset
209 <literal>max_fails</literal> and <literal>fail_timeout</literal> parameters
969
7c542520b8f7 Added note about behavior of a single server in an upstream.
Vladimir Homutov <vl@nginx.com>
parents: 968
diff changeset
210 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
211 </note>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
212 </para>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
213
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
214 </directive>
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
215
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
216
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
217 <directive name="zone">
1495
8d134b482cc3 Documented zone usage with many upstreams.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1481
diff changeset
218 <syntax><value>name</value> [<value>size</value>]</syntax>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
219 <default/>
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
220 <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
221 <appeared-in>1.9.0</appeared-in>
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
222
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
223 <para>
1123
9a9aa8e9d12c Rephrased the "zone" directive, translated into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1122
diff changeset
224 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
225 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
226 shared between worker processes.
1495
8d134b482cc3 Documented zone usage with many upstreams.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1481
diff changeset
227 Several groups may share the same zone.
8d134b482cc3 Documented zone usage with many upstreams.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1481
diff changeset
228 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
229 </para>
4e5cab61e548 Documented status of the zone directive in ngx_http_upstream module.
Vladimir Homutov <vl@nginx.com>
parents: 1450
diff changeset
230
1636
44c4323144c5 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1625
diff changeset
231 </directive>
44c4323144c5 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1625
diff changeset
232
44c4323144c5 Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 1625
diff changeset
233
1230
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
234 <directive name="hash">
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
235 <syntax><value>key</value> [<literal>consistent</literal>]</syntax>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
236 <default/>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
237 <context>upstream</context>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
238 <appeared-in>1.7.2</appeared-in>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
239
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
240 <para>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
241 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
242 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
243 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
244 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
245 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
246 The method is compatible with the
2275
d93c8c32df75 Updated links to CPAN search interface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 2274
diff changeset
247 <link url="https://metacpan.org/pod/Cache::Memcached">Cache::Memcached</link>
1230
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
248 Perl library.
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
249 </para>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
250
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
251 <para>
2282
35fd70c12f98 Resynchronized the http and stream upstream module versions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 2275
diff changeset
252 If the <literal>consistent</literal> parameter is specified,
2274
e28e3d0f0d20 Updated link in the "hash" directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 2230
diff changeset
253 the <link url="https://www.metabrew.com/article/libketama-consistent-hashing-algo-memcached-clients">ketama</link>
1367
f1e14d87d833 Updated commercial docs for the upcoming release.
Ruslan Ermilov <ru@nginx.com>
parents: 1348
diff changeset
254 consistent hashing method will be used instead.
1230
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
255 The method ensures that only a few keys
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
256 will be remapped to different servers
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
257 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
258 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
259 The method is compatible with the
2275
d93c8c32df75 Updated links to CPAN search interface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 2274
diff changeset
260 <link url="https://metacpan.org/pod/Cache::Memcached::Fast">Cache::Memcached::Fast</link>
1236
def99e640654 Fixed grammar.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1233
diff changeset
261 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
262 </para>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
263
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
264 </directive>
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
265
6cc809881694 Upstream: added the "hash" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1194
diff changeset
266
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
267 <directive name="ip_hash">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
268 <syntax/>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
269 <default/>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
270 <context>upstream</context>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
271
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
272 <para>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
273 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
274 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
275 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
276 are used as a hashing key.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
277 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
278 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
279 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
280 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
281 <note>
566
f8148fc88224 Documented 1.2.2 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 542
diff changeset
282 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
283 </note>
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
284 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
285
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
286 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
287 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
288 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
289 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
290 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
291
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
292 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
293 Example:
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
294 <example>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
295 upstream backend {
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
296 ip_hash;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
297
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
298 server backend1.example.com;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
299 server backend2.example.com;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
300 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
301 server backend4.example.com;
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
302 }
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
303 </example>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
304 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
305
526
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
306 <para>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
307 <note>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
308 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
309 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
310 </note>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
311 </para>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
312
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
313 </directive>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
314
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
315
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
316 <directive name="keepalive">
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
317 <syntax><value>connections</value></syntax>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
318 <default/>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
319 <context>upstream</context>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
320 <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
321
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
322 <para>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
323 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
324 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
325
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
326 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
327 The <value>connections</value> parameter sets the maximum number of
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
328 idle keepalive connections to upstream servers that are preserved in
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
329 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
330 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
331 are closed.
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
332 <note>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
333 It should be particularly noted that the <literal>keepalive</literal> directive
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
334 does not limit the total number of connections to upstream servers
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
335 that an nginx worker process can open.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
336 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
337 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
338 </note>
2610
fdfe54a01ea1 Relocated note in keepalive directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2470
diff changeset
339
fdfe54a01ea1 Relocated note in keepalive directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2470
diff changeset
340 <note>
fdfe54a01ea1 Relocated note in keepalive directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2470
diff changeset
341 When using load balancing methods other than the default
fdfe54a01ea1 Relocated note in keepalive directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2470
diff changeset
342 round-robin method, it is necessary to activate them before
fdfe54a01ea1 Relocated note in keepalive directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2470
diff changeset
343 the <literal>keepalive</literal> directive.
fdfe54a01ea1 Relocated note in keepalive directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2470
diff changeset
344 </note>
316
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
345 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
346
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
347 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
348 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
349 <example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
350 upstream memcached_backend {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
351 server 127.0.0.1:11211;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
352 server 10.0.0.2:11211;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
353
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
354 keepalive 32;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
355 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
356
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
357 server {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
358 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
359
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
360 location /memcached/ {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
361 set $memcached_key $uri;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
362 memcached_pass memcached_backend;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
363 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
364
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
365 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
366 </example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
367 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
368
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
369 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
370 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
371 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
372 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
373 <example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
374 upstream http_backend {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
375 server 127.0.0.1:8080;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
376
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
377 keepalive 16;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
378 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
379
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
380 server {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
381 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
382
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
383 location /http/ {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
384 proxy_pass http://http_backend;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
385 proxy_http_version 1.1;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
386 proxy_set_header Connection "";
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
387 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
388 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
389 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
390 </example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
391 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
392
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
393 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
394 <note>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
395 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
396 <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
397 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
398 </note>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
399 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
400
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
401 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
402 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
403 <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
404 for keepalive connections to work:
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
405 <example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
406 upstream fastcgi_backend {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
407 server 127.0.0.1:9000;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
408
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
409 keepalive 8;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
410 }
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 server {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
413 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
414
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
415 location /fastcgi/ {
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
416 fastcgi_pass fastcgi_backend;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
417 fastcgi_keep_conn on;
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
418 ...
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
419 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
420 }
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
421 </example>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
422 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
423
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
424 <para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
425 <note>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
426 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
427 </note>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
428 </para>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
429
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
430 </directive>
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
431
1fb1c077658b Documented the following directives: "keepalive", "proxy_http_version",
Ruslan Ermilov <ru@nginx.com>
parents: 293
diff changeset
432
2223
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
433 <directive name="keepalive_requests">
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
434 <syntax><value>number</value></syntax>
2706
4f44386a16b1 Changed default value of keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2705
diff changeset
435 <default>1000</default>
2223
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
436 <context>upstream</context>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
437 <appeared-in>1.15.3</appeared-in>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
438
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
439 <para>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
440 Sets the maximum number of requests that can be
2225
e2c3d17d0f58 Unified wording of upstream keepalive directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2223
diff changeset
441 served through one keepalive connection.
2223
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
442 After the maximum number of requests is made, the connection is closed.
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
443 </para>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
444
2450
a26a42699207 Added note about max number of keepalive requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2434
diff changeset
445 <para>
a26a42699207 Added note about max number of keepalive requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2434
diff changeset
446 Closing connections periodically is necessary to free
a26a42699207 Added note about max number of keepalive requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2434
diff changeset
447 per-connection memory allocations.
a26a42699207 Added note about max number of keepalive requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2434
diff changeset
448 Therefore, using too high maximum number of requests
a26a42699207 Added note about max number of keepalive requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2434
diff changeset
449 could result in excessive memory usage and not recommended.
a26a42699207 Added note about max number of keepalive requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2434
diff changeset
450 </para>
a26a42699207 Added note about max number of keepalive requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2434
diff changeset
451
2706
4f44386a16b1 Changed default value of keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2705
diff changeset
452 <para>
4f44386a16b1 Changed default value of keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2705
diff changeset
453 <note>
4f44386a16b1 Changed default value of keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2705
diff changeset
454 Prior to version 1.19.10, the default value was 100.
4f44386a16b1 Changed default value of keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2705
diff changeset
455 </note>
4f44386a16b1 Changed default value of keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2705
diff changeset
456 </para>
4f44386a16b1 Changed default value of keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2705
diff changeset
457
2223
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
458 </directive>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
459
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
460
2705
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
461 <directive name="keepalive_time">
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
462 <syntax><value>time</value></syntax>
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
463 <default>1h</default>
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
464 <context>upstream</context>
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
465 <appeared-in>1.19.10</appeared-in>
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
466
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
467 <para>
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
468 Limits the maximum time during which
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
469 requests can be processed through one keepalive connection.
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
470 After this time is reached, the connection is closed
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
471 following the subsequent request processing.
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
472 </para>
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
473
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
474 </directive>
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
475
06805824d0f0 Documented the keepalive_time directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2632
diff changeset
476
2223
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
477 <directive name="keepalive_timeout">
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
478 <syntax><value>timeout</value></syntax>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
479 <default>60s</default>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
480 <context>upstream</context>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
481 <appeared-in>1.15.3</appeared-in>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
482
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
483 <para>
2225
e2c3d17d0f58 Unified wording of upstream keepalive directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2223
diff changeset
484 Sets a timeout during which an idle keepalive
2223
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
485 connection to an upstream server will stay open.
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
486 </para>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
487
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
488 </directive>
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
489
a692df6ef304 Added upstream keepalive_timeout and keepalive_requests.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2222
diff changeset
490
526
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
491 <directive name="least_conn">
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
492 <syntax/>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
493 <default/>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
494 <context>upstream</context>
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
495 <appeared-in>1.3.1</appeared-in>
566
f8148fc88224 Documented 1.2.2 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 542
diff changeset
496 <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
497
4f907cde0382 1.3.1 changes: ip_hash+weight, least_conn.
Ruslan Ermilov <ru@nginx.com>
parents: 316
diff changeset
498 <para>
533
fb630c3c5039 Revamped the upstream documentation somewhat.
Ruslan Ermilov <ru@nginx.com>
parents: 526
diff changeset
499 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
500 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
501 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
502 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
503 weighted round-robin balancing method.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
504 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
505
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
506 </directive>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
507
953
aded7086e84f Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents: 942
diff changeset
508
2191
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
509 <directive name="random">
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
510 <syntax>[<literal>two</literal> [<value>method</value>]]</syntax>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
511 <default/>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
512 <context>upstream</context>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
513 <appeared-in>1.15.1</appeared-in>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
514
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
515 <para>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
516 Specifies that a group should use a load balancing method where a request
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
517 is passed to a randomly selected server, taking into account weights
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
518 of servers.
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
519 </para>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
520
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
521 <para>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
522 The optional <literal>two</literal> parameter
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
523 instructs nginx to randomly select
2197
03f8a9c5e8ae Updated link in the "random" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2191
diff changeset
524 <link url="https://homes.cs.washington.edu/~karlin/papers/balls.pdf">two</link>
2191
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
525 servers and then choose a server
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
526 using the specified <literal>method</literal>.
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
527 The default method is <literal>least_conn</literal>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
528 which passes a request to a server
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
529 with the least number of active connections.
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
530 </para>
2c56f91c304a Documented the "random" directive.
Vladimir Homutov <vl@nginx.com>
parents: 2139
diff changeset
531
1026
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
532 </directive>
3056640d5022 Upstream: documented new "sticky" features.
Ruslan Ermilov <ru@nginx.com>
parents: 1011
diff changeset
533
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
534 </section>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
535
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
536
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
537 <section id="variables" name="Embedded Variables">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
538
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
539 <para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
540 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
541 supports the following embedded variables:
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
542 <list type="tag">
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
543
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
544 <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
545 <tag-desc>
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
546 keeps the IP address and port,
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
547 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
548 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
549 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
550 “<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
551 If an internal redirect from one server group to another happens,
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
552 initiated by
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
553 <header>X-Accel-Redirect</header> or
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
554 <link doc="ngx_http_core_module.xml" id="error_page"/>,
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
555 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
556 “<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>”.
2058
eb58ee50561d Documented upstream name in $upstream_addr.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2041
diff changeset
557 If a server cannot be selected,
eb58ee50561d Documented upstream name in $upstream_addr.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2041
diff changeset
558 the variable keeps the name of the server group.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
559 </tag-desc>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
560
1783
031566771bbd Documented $upstream_bytes_received for http upstream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1722
diff changeset
561 <tag-name id="var_upstream_bytes_received"><var>$upstream_bytes_received</var></tag-name>
031566771bbd Documented $upstream_bytes_received for http upstream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1722
diff changeset
562 <tag-desc>
031566771bbd Documented $upstream_bytes_received for http upstream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1722
diff changeset
563 number of bytes received from an upstream server (1.11.4).
031566771bbd Documented $upstream_bytes_received for http upstream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1722
diff changeset
564 Values from several connections
031566771bbd Documented $upstream_bytes_received for http upstream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1722
diff changeset
565 are separated by commas and colons like addresses in the
031566771bbd Documented $upstream_bytes_received for http upstream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1722
diff changeset
566 <link id="var_upstream_addr">$upstream_addr</link> variable.
031566771bbd Documented $upstream_bytes_received for http upstream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1722
diff changeset
567 </tag-desc>
031566771bbd Documented $upstream_bytes_received for http upstream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1722
diff changeset
568
2307
994207cf96da Documented the "$upstream_bytes_sent" variable for http.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2282
diff changeset
569 <tag-name id="var_upstream_bytes_sent"><var>$upstream_bytes_sent</var></tag-name>
994207cf96da Documented the "$upstream_bytes_sent" variable for http.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2282
diff changeset
570 <tag-desc>
994207cf96da Documented the "$upstream_bytes_sent" variable for http.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2282
diff changeset
571 number of bytes sent to an upstream server (1.15.8).
994207cf96da Documented the "$upstream_bytes_sent" variable for http.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2282
diff changeset
572 Values from several connections
994207cf96da Documented the "$upstream_bytes_sent" variable for http.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2282
diff changeset
573 are separated by commas and colons like addresses in the
994207cf96da Documented the "$upstream_bytes_sent" variable for http.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2282
diff changeset
574 <link id="var_upstream_addr">$upstream_addr</link> variable.
994207cf96da Documented the "$upstream_bytes_sent" variable for http.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2282
diff changeset
575 </tag-desc>
994207cf96da Documented the "$upstream_bytes_sent" variable for http.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2282
diff changeset
576
3084
0bbf14c9fd66 Documented $upstream_cache_key.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3043
diff changeset
577 <tag-name id="var_upstream_cache_key"><var>$upstream_cache_key</var>
0bbf14c9fd66 Documented $upstream_cache_key.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3043
diff changeset
578 </tag-name>
0bbf14c9fd66 Documented $upstream_cache_key.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3043
diff changeset
579 <tag-desc>
0bbf14c9fd66 Documented $upstream_cache_key.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3043
diff changeset
580 the cache key being used (1.27.1).
0bbf14c9fd66 Documented $upstream_cache_key.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3043
diff changeset
581 </tag-desc>
0bbf14c9fd66 Documented $upstream_cache_key.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3043
diff changeset
582
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
583 <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
584 </tag-name>
731
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
585 <tag-desc>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 962
diff changeset
586 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
587 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
588 “<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
589 “<literal>STALE</literal>”, “<literal>UPDATING</literal>”,
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
590 “<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
591 </tag-desc>
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
592
1481
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
593 <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
594 </tag-name>
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
595 <tag-desc>
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
596 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
597 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
598 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
599 Times of several connections
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
600 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
601 <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
602 </tag-desc>
f29398a167d0 Documented the upstream_connect_time variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1461
diff changeset
603
1186
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
604 <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
605 </tag-name>
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
606 <tag-desc>
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
607 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
608 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
609 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
610 </tag-desc>
8125bec5c7a1 Upstream: documented the $upstream_cookie_* variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1181
diff changeset
611
1393
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
612 <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
613 </tag-name>
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
614 <tag-desc>
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
615 keeps time
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
616 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
617 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
618 Times of several responses
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
619 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
620 <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
621 </tag-desc>
15e8779f0ceb Documented the $upstream_header_time variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1392
diff changeset
622
1392
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
623 <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
624 <tag-desc>
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
625 keep server response header fields.
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
626 For example, the <header>Server</header> response header field
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
627 is available through the <var>$upstream_http_server</var> variable.
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
628 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
629 as for the variables that start with the
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
630 “<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
631 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
632 </tag-desc>
82e62822abe8 Sorted upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1391
diff changeset
633
2139
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
634 <tag-name id="var_upstream_queue_time"><var>$upstream_queue_time</var></tag-name>
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
635 <tag-desc>
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
636 keeps time the request spent in the upstream <link id="queue">queue</link>
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
637 (1.13.9);
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
638 the time is kept in seconds with millisecond resolution.
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
639 Times of several responses
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
640 are separated by commas and colons like addresses in the
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
641 <link id="var_upstream_addr">$upstream_addr</link> variable.
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
642 </tag-desc>
f6e578b1b02d Updated docs for the upcoming NGINX Plus release.
Ruslan Ermilov <ru@nginx.com>
parents: 2134
diff changeset
643
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
644 <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
645 </tag-name>
731
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
646 <tag-desc>
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
647 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
648 the length is kept in bytes.
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
649 Lengths of several responses
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
650 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
651 <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
652 </tag-desc>
f62328124e5b Documented $upstream_cache_status and $upstream_response_length variables.
Vladimir Homutov <vl@nginx.com>
parents: 654
diff changeset
653
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
654 <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
655 </tag-name>
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
656 <tag-desc>
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
657 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
658 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
659 Times of several responses
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
660 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
661 <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
662 </tag-desc>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
663
1155
07402a11fd8d Assigned IDs to tags describing variables.
Vladimir Homutov <vl@nginx.com>
parents: 1128
diff changeset
664 <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
665 <tag-desc>
1391
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
666 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
667 Status codes of several responses
0702cc081c63 Revised descriptions of upstream module variables.
Ruslan Ermilov <ru@nginx.com>
parents: 1386
diff changeset
668 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
669 <link id="var_upstream_addr">$upstream_addr</link> variable.
2062
7275c134ec67 Documented "no live upstreams" case for $upstream_status.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2058
diff changeset
670 If a server cannot be selected,
7275c134ec67 Documented "no live upstreams" case for $upstream_status.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2058
diff changeset
671 the variable keeps the <http-status code="502" text="Bad Gateway"/> status code.
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
672 </tag-desc>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
673
2113
180269c4a220 Documented the "upstream_trailer_" variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2097
diff changeset
674 <tag-name id="var_upstream_trailer_"><var>$upstream_trailer_</var><value>name</value></tag-name>
180269c4a220 Documented the "upstream_trailer_" variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2097
diff changeset
675 <tag-desc>
180269c4a220 Documented the "upstream_trailer_" variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2097
diff changeset
676 keeps fields from the end of the response
180269c4a220 Documented the "upstream_trailer_" variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2097
diff changeset
677 obtained from the upstream server (1.13.10).
180269c4a220 Documented the "upstream_trailer_" variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2097
diff changeset
678 </tag-desc>
180269c4a220 Documented the "upstream_trailer_" variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2097
diff changeset
679
293
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
680 </list>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
681 </para>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
682
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
683 </section>
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
684
34246e706f48 English translation of the ngx_http_upstream_module documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
685 </module>