# HG changeset patch # User Yaroslav Zhuravlev # Date 1423139043 -10800 # Node ID 4569719f4247130bcdd913f71335faa94fefb7e1 # Parent 54d39c91a14d7fd33c592ec8ec337b17be55a9d7 Split stream module into stream_core and stream_proxy modules. diff --git a/xml/en/GNUmakefile b/xml/en/GNUmakefile --- a/xml/en/GNUmakefile +++ b/xml/en/GNUmakefile @@ -90,7 +90,8 @@ REFS = \ mail/ngx_mail_proxy_module \ mail/ngx_mail_smtp_module \ mail/ngx_mail_ssl_module \ - stream/ngx_stream_module \ + stream/ngx_stream_core_module \ + stream/ngx_stream_proxy_module \ stream/ngx_stream_upstream_module \ TOP = \ diff --git a/xml/en/docs/index.xml b/xml/en/docs/index.xml --- a/xml/en/docs/index.xml +++ b/xml/en/docs/index.xml @@ -467,8 +467,13 @@ ngx_mail_smtp_module - -ngx_stream_module + +ngx_stream_core_module + + + + +ngx_stream_proxy_module diff --git a/xml/en/docs/stream/ngx_stream_module.xml b/xml/en/docs/stream/ngx_stream_core_module.xml rename from xml/en/docs/stream/ngx_stream_module.xml rename to xml/en/docs/stream/ngx_stream_core_module.xml --- a/xml/en/docs/stream/ngx_stream_module.xml +++ b/xml/en/docs/stream/ngx_stream_core_module.xml @@ -1,25 +1,19 @@ - + rev="1">
-The ngx_stream_module module (1.7.7) provides -support for proxying TCP and UNIX-domain socket connections. - - - This module is available as part of our commercial subscription. @@ -33,53 +27,32 @@ This module is available as part of our +worker_processes auto; + +error_log /var/log/nginx/error.log info; + stream { upstream backend { - least_conn; - server srv1.example.com:8000; - server srv2.example.com:8000; - server srv3.example.com:8001; + hash $remote_addr consistent; + + server backend1.example.com:12345 weight=5; + server 127.0.0.1:12345 max_fails=3 fail_timeout=30s; + server unix:/tmp/backend3; } server { - listen 9000; + listen 12345; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass backend; } + + server { + listen [::1]:12345; + proxy_pass unix:/tmp/stream.socket; + } } -In this example, a server that listens on port 9000 -proxies -TCP connections to a group of servers named backend. -Note that the -directive defined in the context -must not contain a protocol. -Two optional timeout parameters are specified: -the sets -a timeout required for establishing a connection with a server -that belongs to the backend group, while the - sets -a timeout used after proxying to one of the servers in the -backend group had started. -All TCP proxy-related functionality is configured inside the - block -just like the block -for HTTP requests. - - - -The backend group consists of three physical servers -(srv1-srv3). -Each server name follows the obligatory port number. -TCP connections are distributed among the servers according to the -least -connected load balancing method: a connection will go to the server -that has the least number of active connections. -Directives required to configure a group of proxied servers -and load-balancing can be found in the -ngx_stream_upstream_module -module.
@@ -102,15 +75,15 @@ on which the server will accept connecti It is possible to specify just the port. The address can also be a hostname, for example: -listen 127.0.0.1:110; -listen *:110; -listen 110; # same as *:110 -listen localhost:110; +listen 127.0.0.1:12345; +listen *:12345; +listen 12345; # same as *:12345 +listen localhost:12345; IPv6 addresses are specified in square brackets: -listen [::1]:110; -listen [::]:110; +listen [::1]:12345; +listen [::]:12345; UNIX-domain sockets are specified with the “unix:” prefix: @@ -195,88 +168,6 @@ Different servers must listen on differe - -time -60s -stream -server - - -Defines a timeout for establishing a connection with a proxied server. - - - - - - -size -16k -stream -server - - -Sets the size of the -buffers used for reading data from the client. - - - - - - -address - -server - - -Sets the address of a proxied server. -The address can be specified as a domain name or IP address, -and an obligatory port: - -proxy_pass localhost:8000; - -or as a UNIX-domain socket path: - -proxy_pass unix:/tmp/stream.socket; - - - - -If a domain name resolves to several addresses, all of them will be -used in a round-robin fashion. -In addition, an address can be specified as a -server group. - - - - - - -timeout -10m -stream -server - - -Defines a timeout used after the proxying to the backend had started. - - - - - - -size -16k -stream -server - - -Sets the size of the -buffers used for reading data from the upstream server. - - - - - diff --git a/xml/en/docs/stream/ngx_stream_module.xml b/xml/en/docs/stream/ngx_stream_proxy_module.xml copy from xml/en/docs/stream/ngx_stream_module.xml copy to xml/en/docs/stream/ngx_stream_proxy_module.xml --- a/xml/en/docs/stream/ngx_stream_module.xml +++ b/xml/en/docs/stream/ngx_stream_proxy_module.xml @@ -1,22 +1,21 @@ - + rev="1">
-The ngx_stream_module module (1.7.7) provides -support for proxying TCP and UNIX-domain socket connections. +The ngx_stream_proxy_module module (1.7.7) allows passing +connections to another server over TCP and UNIX-domain sockets. @@ -33,53 +32,23 @@ This module is available as part of our -stream { - upstream backend { - least_conn; - server srv1.example.com:8000; - server srv2.example.com:8000; - server srv3.example.com:8001; - } +server { + listen 127.0.0.1:12345; + proxy_pass 127.0.0.1:8080; +} - server { - listen 9000; - proxy_connect_timeout 1s; - proxy_timeout 3s; - proxy_pass backend; - } +server { + listen 12345; + proxy_connect_timeout 1s; + proxy_timeout 3s; + proxy_pass example.com:12345; +} + +server { + listen [::1]:12345; + proxy_pass unix:/tmp/stream.socket; } -In this example, a server that listens on port 9000 -proxies -TCP connections to a group of servers named backend. -Note that the -directive defined in the context -must not contain a protocol. -Two optional timeout parameters are specified: -the sets -a timeout required for establishing a connection with a server -that belongs to the backend group, while the - sets -a timeout used after proxying to one of the servers in the -backend group had started. -All TCP proxy-related functionality is configured inside the - block -just like the block -for HTTP requests. - - - -The backend group consists of three physical servers -(srv1-srv3). -Each server name follows the obligatory port number. -TCP connections are distributed among the servers according to the -least -connected load balancing method: a connection will go to the server -that has the least number of active connections. -Directives required to configure a group of proxied servers -and load-balancing can be found in the -ngx_stream_upstream_module -module.
@@ -87,114 +56,6 @@ module.
- - - address:port - [bind] - [ipv6only=on|off] - [so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt]] - -server - - -Sets the address and port for the socket -on which the server will accept connections. -It is possible to specify just the port. -The address can also be a hostname, for example: - -listen 127.0.0.1:110; -listen *:110; -listen 110; # same as *:110 -listen localhost:110; - -IPv6 addresses are specified in square brackets: - -listen [::1]:110; -listen [::]:110; - -UNIX-domain sockets are specified with the “unix:” -prefix: - -listen unix:/var/run/nginx.sock; - - - - - -The directive supports the following parameters: - - - - -bind - - -this parameter instructs to make a separate bind -call for a given address:port pair. -The fact is that if there are several listen directives with -the same port but different addresses, and one of the -listen directives listens on all addresses -for the given port (*:port), nginx will -bind only to *:port. -It should be noted that the getsockname system call will be -made in this case to determine the address that accepted the connection. -If the ipv6only -or so_keepalive parameters -are used then for a given -address:port pair -a separate bind call will always be made. - - - -ipv6only=on|off - - -this parameter determines -(via the IPV6_V6ONLY socket option) -whether an IPv6 socket listening on a wildcard address [::] -will accept only IPv6 connections or both IPv6 and IPv4 connections. -This parameter is turned on by default. -It can only be set once on start. - - - -so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt] - - -this parameter configures the “TCP keepalive” behavior -for the listening socket. -If this parameter is omitted then the operating system’s settings will be -in effect for the socket. -If it is set to the value “on”, the -SO_KEEPALIVE option is turned on for the socket. -If it is set to the value “off”, the -SO_KEEPALIVE option is turned off for the socket. -Some operating systems support setting of TCP keepalive parameters on -a per-socket basis using the TCP_KEEPIDLE, -TCP_KEEPINTVL, and TCP_KEEPCNT socket options. -On such systems (currently, Linux 2.4+, NetBSD 5+, and -FreeBSD 9.0-STABLE), they can be configured -using the keepidle, keepintvl, and -keepcnt parameters. -One or two parameters may be omitted, in which case the system default setting -for the corresponding socket option will be in effect. -For example, -so_keepalive=30m::10 -will set the idle timeout (TCP_KEEPIDLE) to 30 minutes, -leave the probe interval (TCP_KEEPINTVL) at its system default, -and set the probes count (TCP_KEEPCNT) to 10 probes. - - - - - -Different servers must listen on different -address:port pairs. - - - - - time 60s @@ -232,7 +93,7 @@ Sets the address of a proxied server. The address can be specified as a domain name or IP address, and an obligatory port: -proxy_pass localhost:8000; +proxy_pass localhost:12345; or as a UNIX-domain socket path: @@ -276,31 +137,6 @@ buffers used for reading data from the u - - - - -stream - - -Sets the configuration for a server. - - - - - - - - -main - - -Provides the configuration file context in which the stream server directives -are specified. - - - -
diff --git a/xml/en/docs/stream/ngx_stream_upstream_module.xml b/xml/en/docs/stream/ngx_stream_upstream_module.xml --- a/xml/en/docs/stream/ngx_stream_upstream_module.xml +++ b/xml/en/docs/stream/ngx_stream_upstream_module.xml @@ -10,14 +10,14 @@ + rev="2">
The ngx_stream_upstream_module module (1.7.7) is used to define groups of servers that can be referenced -by the +by the directive.