comparison xml/en/docs/stream/ngx_stream_core_module.xml @ 1405:4569719f4247

Split stream module into stream_core and stream_proxy modules.
author Yaroslav Zhuravlev <yar@nginx.com>
date Thu, 05 Feb 2015 15:24:03 +0300
parents xml/en/docs/stream/ngx_stream_module.xml@66f227952864
children f5b5eefc43cb
comparison
equal deleted inserted replaced
1404:54d39c91a14d 1405:4569719f4247
1 <?xml version="1.0"?>
2
3 <!--
4 Copyright (C) Nginx, Inc.
5 -->
6
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
8
9 <module name="Module ngx_stream_core_module"
10 link="/en/docs/stream/ngx_stream_core_module.html"
11 lang="en"
12 rev="1">
13
14 <section id="summary">
15
16 <para>
17 <note>
18 This module is available as part of our
19 <commercial_version>commercial subscription</commercial_version>.
20 </note>
21 </para>
22
23 </section>
24
25
26 <section id="example" name="Example Configuration">
27
28 <para>
29 <example>
30 worker_processes auto;
31
32 error_log /var/log/nginx/error.log info;
33
34 stream {
35 upstream backend {
36 hash $remote_addr consistent;
37
38 server backend1.example.com:12345 weight=5;
39 server 127.0.0.1:12345 max_fails=3 fail_timeout=30s;
40 server unix:/tmp/backend3;
41 }
42
43 server {
44 listen 12345;
45 proxy_connect_timeout 1s;
46 proxy_timeout 3s;
47 proxy_pass backend;
48 }
49
50 server {
51 listen [::1]:12345;
52 proxy_pass unix:/tmp/stream.socket;
53 }
54 }
55 </example>
56 </para>
57
58 </section>
59
60
61 <section id="directives" name="Directives">
62
63 <directive name="listen">
64 <syntax>
65 <value>address</value>:<value>port</value>
66 [<literal>bind</literal>]
67 [<literal>ipv6only</literal>=<literal>on</literal>|<literal>off</literal>]
68 [<literal>so_keepalive</literal>=<literal>on</literal>|<literal>off</literal>|[<value>keepidle</value>]:[<value>keepintvl</value>]:[<value>keepcnt</value>]]</syntax>
69 <default/>
70 <context>server</context>
71
72 <para>
73 Sets the <value>address</value> and <value>port</value> for the socket
74 on which the server will accept connections.
75 It is possible to specify just the port.
76 The address can also be a hostname, for example:
77 <example>
78 listen 127.0.0.1:12345;
79 listen *:12345;
80 listen 12345; # same as *:12345
81 listen localhost:12345;
82 </example>
83 IPv6 addresses are specified in square brackets:
84 <example>
85 listen [::1]:12345;
86 listen [::]:12345;
87 </example>
88 UNIX-domain sockets are specified with the “<literal>unix:</literal>”
89 prefix:
90 <example>
91 listen unix:/var/run/nginx.sock;
92 </example>
93
94 </para>
95
96 <para>
97 The directive supports the following parameters:
98
99 <list type="tag">
100
101 <tag-name id="bind">
102 <literal>bind</literal>
103 </tag-name>
104 <tag-desc>
105 this parameter instructs to make a separate <c-func>bind</c-func>
106 call for a given address:port pair.
107 The fact is that if there are several <literal>listen</literal> directives with
108 the same port but different addresses, and one of the
109 <literal>listen</literal> directives listens on all addresses
110 for the given port (<literal>*:</literal><value>port</value>), nginx will
111 <c-func>bind</c-func> only to <literal>*:</literal><value>port</value>.
112 It should be noted that the <c-func>getsockname</c-func> system call will be
113 made in this case to determine the address that accepted the connection.
114 If the <literal>ipv6only</literal>
115 or <literal>so_keepalive</literal> parameters
116 are used then for a given
117 <value>address</value>:<value>port</value> pair
118 a separate <c-func>bind</c-func> call will always be made.
119 </tag-desc>
120
121 <tag-name id="ipv6only">
122 <literal>ipv6only</literal>=<literal>on</literal>|<literal>off</literal>
123 </tag-name>
124 <tag-desc>
125 this parameter determines
126 (via the <c-def>IPV6_V6ONLY</c-def> socket option)
127 whether an IPv6 socket listening on a wildcard address <literal>[::]</literal>
128 will accept only IPv6 connections or both IPv6 and IPv4 connections.
129 This parameter is turned on by default.
130 It can only be set once on start.
131 </tag-desc>
132
133 <tag-name id="so_keepalive">
134 <literal>so_keepalive</literal>=<literal>on</literal>|<literal>off</literal>|[<value>keepidle</value>]:[<value>keepintvl</value>]:[<value>keepcnt</value>]
135 </tag-name>
136 <tag-desc>
137 this parameter configures the “TCP keepalive” behavior
138 for the listening socket.
139 If this parameter is omitted then the operating system’s settings will be
140 in effect for the socket.
141 If it is set to the value “<literal>on</literal>”, the
142 <c-def>SO_KEEPALIVE</c-def> option is turned on for the socket.
143 If it is set to the value “<literal>off</literal>”, the
144 <c-def>SO_KEEPALIVE</c-def> option is turned off for the socket.
145 Some operating systems support setting of TCP keepalive parameters on
146 a per-socket basis using the <c-def>TCP_KEEPIDLE</c-def>,
147 <c-def>TCP_KEEPINTVL</c-def>, and <c-def>TCP_KEEPCNT</c-def> socket options.
148 On such systems (currently, Linux 2.4+, NetBSD 5+, and
149 FreeBSD 9.0-STABLE), they can be configured
150 using the <value>keepidle</value>, <value>keepintvl</value>, and
151 <value>keepcnt</value> parameters.
152 One or two parameters may be omitted, in which case the system default setting
153 for the corresponding socket option will be in effect.
154 For example,
155 <example>so_keepalive=30m::10</example>
156 will set the idle timeout (<c-def>TCP_KEEPIDLE</c-def>) to 30 minutes,
157 leave the probe interval (<c-def>TCP_KEEPINTVL</c-def>) at its system default,
158 and set the probes count (<c-def>TCP_KEEPCNT</c-def>) to 10 probes.
159 </tag-desc>
160 </list>
161 </para>
162
163 <para>
164 Different servers must listen on different
165 <value>address</value>:<value>port</value> pairs.
166 </para>
167
168 </directive>
169
170
171 <directive name="server">
172 <syntax block="yes"/>
173 <default/>
174 <context>stream</context>
175
176 <para>
177 Sets the configuration for a server.
178 </para>
179
180 </directive>
181
182
183 <directive name="stream">
184 <syntax block="yes"/>
185 <default/>
186 <context>main</context>
187
188 <para>
189 Provides the configuration file context in which the stream server directives
190 are specified.
191 </para>
192
193 </directive>
194
195 </section>
196
197 </module>