# HG changeset patch # User Ruslan Ermilov # Date 1428596334 -10800 # Node ID f5b5eefc43cb67e82e40fa27cdf0d68a3ff23294 # Parent c79501e16e26c7a6b2a99606ca4da3b54461b722 Updated commercial docs for the upcoming release. diff -r c79501e16e26 -r f5b5eefc43cb xml/en/GNUmakefile --- a/xml/en/GNUmakefile Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/en/GNUmakefile Thu Apr 09 19:18:54 2015 +0300 @@ -80,6 +80,7 @@ http/ngx_http_stub_status_module \ http/ngx_http_sub_module \ http/ngx_http_upstream_module \ + http/ngx_http_upstream_conf_module \ http/ngx_http_userid_module \ http/ngx_http_uwsgi_module \ http/ngx_http_xslt_module \ @@ -92,6 +93,7 @@ mail/ngx_mail_ssl_module \ stream/ngx_stream_core_module \ stream/ngx_stream_proxy_module \ + stream/ngx_stream_ssl_module \ stream/ngx_stream_upstream_module \ TOP = \ diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/http/ngx_http_status_module.xml --- a/xml/en/docs/http/ngx_http_status_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/en/docs/http/ngx_http_status_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -9,7 +9,7 @@ + rev="6">
@@ -32,40 +32,58 @@ -upstream backend { - zone upstream_backend 64k; +http { + upstream backend { + zone http_backend 64k; + + server backend1.example.com weight=5; + server backend2.example.com; + } + + proxy_cache_path /data/nginx/cache_backend keys_zone=cache_backend:10m; + + server { + server_name backend.example.com; + + location / { + proxy_pass http://backend; + proxy_cache cache_backend; - server backend1.example.com weight=5; - server backend2.example.com; + health_check; + } + + status_zone server_backend; + } + + server { + listen 127.0.0.1; + + location /upstream_conf { + upstream_conf; + } + + location /status { + status; + } + + location = /status.html { + } + } } -proxy_cache_path /data/nginx/cache_backend keys_zone=cache_backend:10m; - -server { - server_name backend.example.com; +stream { + upstream backend { + zone stream_backend 64k; - location / { - proxy_pass http://backend; - proxy_cache cache_backend; - - health_check; + server backend1.example.com:12345 weight=5; + server backend2.example.com:12345; } - status_zone server_backend; -} - -server { - listen 127.0.0.1; - - location /upstream_conf { - upstream_conf; - } - - location /status { - status; - } - - location = /status.html { + server { + listen 127.0.0.1:12345; + proxy_pass backend; + status_zone server_backend; + health_check; } } @@ -81,6 +99,11 @@ http://127.0.0.1/status/upstreams/backend http://127.0.0.1/status/upstreams/backend/1 http://127.0.0.1/status/upstreams/backend/1/weight +http://127.0.0.1/status/stream +http://127.0.0.1/status/stream/upstreams +http://127.0.0.1/status/stream/upstreams/backend +http://127.0.0.1/status/stream/upstreams/backend/1 +http://127.0.0.1/status/stream/upstreams/backend/1/weight @@ -138,9 +161,11 @@ Enables collection of virtual - -status information in the specified zone. -Several virtual servers may share the same zone. +http +or +stream +(1.7.11) server status information in the specified zone. +Several servers may share the same zone. @@ -157,7 +182,7 @@ version Version of the provided data set. -The current version is 4. +The current version is 5. nginx_version @@ -170,6 +195,12 @@ The address of the server that accepted status request. +generation + +The total number of configuration +reloads. + + load_timestamp Time of the last reload of configuration, in milliseconds since Epoch. @@ -180,6 +211,19 @@ Current time in milliseconds since Epoch. +processes + + + +respawned + +The total number of abnormally terminated and respawned +child processes. + + + + + connections @@ -330,11 +374,13 @@ The current number of active connections. + max_conns @@ -451,6 +497,26 @@ when the server was last selected to process a request (1.7.5). +header_time + +The average time to get the +response +header from the server (1.7.10). +The field is available when using the + +load balancing method. + + +response_time + +The average time to get the +full +response from the server (1.7.10). +The field is available when using the + +load balancing method. + + @@ -537,6 +603,206 @@ +stream + + + +server_zones + +For each : + + +processing + +The number of +client connections that are currently being processed. + + +connections + +The total number of +connections accepted from clients. + + +received + +The total number of bytes received from clients. + + +sent + +The total number of bytes sent to clients. + + + + + +upstreams + +For each + +in the +dynamically +configurable +group, +the following data are provided: + + +id + +The ID of the server. + + +server + +An +address +of the server. + + +backup + +A boolean value indicating whether the server is a + +server. + + +weight + +Weight +of the server. + + +state + +Current state, which may be one of +“up”, +“down”, +“unavail”, +or +“unhealthy”. + + +active + +The current number of connections. + + +connections + +The total number of +client connections forwarded to this server. + + +connect_time + +The average time to connect to the upstream server. +The field is available when using the + +load balancing method. + + +first_byte_time + +The average time to receive the first byte of data. +The field is available when using the + +load balancing method. + + +response_time + +The average time to receive the last byte of data. +The field is available when using the + +load balancing method. + + +sent + +The total number of bytes sent to this server. + + +received + +The total number of bytes received from this server. + + +fails + +The total number of +unsuccessful attempts to communicate with the server. + + +unavail + +How many times +the server became unavailable for client connections +(state “unavail”) +due to the number of unsuccessful attempts reaching the + +threshold. + + +health_checks + + + +checks + +The total number of +health check +requests made. + + +fails + +The number of failed health checks. + + +unhealthy + +How many times +the server became unhealthy (state “unhealthy”). + + +last_passed + +Boolean indicating +if the last health check request was successful and passed +tests. + + + + + +downtime + +Total time +the server was in the “unavail” +and “unhealthy” states. + + +downstart + +The time (in milliseconds since Epoch) +when the server became +“unavail” +or “unhealthy”. + + +selected + +The time (in milliseconds since Epoch) +when the server was last selected to process a connection. + + + + + + + + @@ -548,6 +814,36 @@ +The keepalive field of an upstream server +was removed in 5. + + + +The stream status data +were added in 5. + + + +The + field +was added in 5. + + + +The + field in + +was added in 5. + + + +The + and fields in + +were added in 5. + + + The field in diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/http/ngx_http_upstream_conf_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_upstream_conf_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -0,0 +1,350 @@ + + + + + + + + +
+ + +The ngx_http_upstream_conf_module module +allows configuring upstream server groups on-the-fly +via a simple HTTP interface without the need of restarting nginx. +The +http +or +stream +server group must reside in the shared memory. + + +
+ + +
+ + + +upstream backend { + zone upstream_backend 64k; + + ... +} + +server { + location /upstream_conf { + upstream_conf; + allow 127.0.0.1; + deny all; + } +} + + + +
+ + +
+ + + + +location + + +Turns on the HTTP interface of upstream configuration in the surrounding +location. +Access to this location should be +limited. + + + +Configuration commands can be used to: + + +view the group configuration; + +view, modify, or remove a server; + +add a new server. + + + +Since addresses in a group are not required to be unique, specific +servers in a group are referenced by their IDs. +IDs are assigned automatically and shown when adding a new server +or viewing the group configuration. + + + + +A configuration command consists of parameters passed as request arguments, +for example: + +http://127.0.0.1/upstream_conf?upstream=backend + + + + +The following parameters are supported: + + + + +stream= + +Selects a +stream +upstream server group. +Without this parameter, selects an +http +upstream server group. + + + +upstream=name + +Selects a group to work with. +This parameter is mandatory. + + + +id=number + +Selects a server for viewing, modifying, or removing. + + + +remove= + +Removes a server from the group. + + + +add= + +Adds a new server to the group. + + + +backup= + +Required to add a backup server. + +Before version 1.7.2, backup= +was also required to view, modify, or remove existing backup servers. + + + + +server=address + +Same as the “address” parameter +of the +http +or +stream +upstream server. + +When adding a server, it is possible to specify it as a domain name. +In this case, changes of the IP addresses that correspond to a domain name +will be monitored and automatically applied to the upstream +configuration without the need of restarting nginx (1.7.2). +This requires the “resolver” directive in the +http +or +stream +block. +See also the “resolve” parameter +of the +http +or +stream +upstream server. + + + + +weight=number + +Same as the “weight” parameter +of the +http +or +stream +upstream server. + + + +max_conns=number + +Same as the “max_conns” parameter +of the +http +or +stream +upstream server. + + + +max_fails=number + +Same as the “max_fails” parameter +of the +http +or +stream +upstream server. + + + +fail_timeout=time + +Same as the “fail_timeout” parameter +of the +http +or +stream +upstream server. + + + +slow_start=time + +Same as the “slow_start” parameter +of the +http +or +stream +upstream server. + + + +down= + +Same as the “down” parameter +of the +http +or +stream +upstream server. + + +drain= + +Puts the +http +upstream server in the “draining” mode (1.7.5). +In this mode, only requests of the +bound to the server +will be proxied to it. + + + +up= + +The opposite of the “down” parameter +of the +http +or +stream +upstream server. + + + +route=string + +Same as the “route” parameter of the +http +upstream server. + + + + +The first three parameters select an object. +This can be either the whole http or stream upstream server group, +or a specific server. +Without other parameters, the configuration of the selected +group or server is shown. + + + +For example, to view the configuration of the whole group, send: + +http://127.0.0.1/upstream_conf?upstream=backend + + +To view the configuration of a specific server, also specify its ID: + +http://127.0.0.1/upstream_conf?upstream=backend&id=42 + + + + +To add a new server, +specify its address in the “server=” parameter. +Without other parameters specified, a server will be added with other +parameters set to their default values (see the +http +or +stream +“server” directive). + + + +For example, to add a new primary server, send: + +http://127.0.0.1/upstream_conf?add=&upstream=backend&server=127.0.0.1:8080 + + +To add a new backup server, send: + +http://127.0.0.1/upstream_conf?add=&upstream=backend&backup=&server=127.0.0.1:8080 + + +To add a new primary server, +set its parameters to non-default values +and mark it as “down”, send: + +http://127.0.0.1/upstream_conf?add=&upstream=backend&server=127.0.0.1:8080&weight=2&down= + + +To remove a server, specify its ID: + +http://127.0.0.1/upstream_conf?remove=&upstream=backend&id=42 + + +To mark an existing server as “down”, send: + +http://127.0.0.1/upstream_conf?upstream=backend&id=42&down= + + +To modify the address of an existing server, send: + +http://127.0.0.1/upstream_conf?upstream=backend&id=42&server=192.0.2.3:8123 + + +To modify other parameters of an existing server, send: + +http://127.0.0.1/upstream_conf?upstream=backend&id=42&max_fails=3&weight=4 + + +The above examples are for an +http +upstream server group. +Similar examples for a +stream +upstream server group require the “stream=” parameter. + + + + +
+ +
diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/http/ngx_http_upstream_module.xml --- a/xml/en/docs/http/ngx_http_upstream_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/en/docs/http/ngx_http_upstream_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -10,7 +10,7 @@ + rev="36">
@@ -53,12 +53,15 @@ available as part of our commercial subscription: +resolver 10.0.0.1; + upstream dynamic { zone upstream_dynamic 64k; server backend1.example.com weight=5; server backend2.example.com:8080 fail_timeout=5s slow_start=30s; server 192.0.2.1 max_fails=3; + server backend3.example.com resolve; server backup1.example.com:8080 backup; server backup2.example.com:8080 backup; @@ -69,12 +72,6 @@ proxy_pass http://dynamic; health_check; } - - location /upstream_conf { - upstream_conf; - allow 127.0.0.1; - deny all; - } } @@ -298,7 +295,8 @@ or modifying the settings of a particular server without the need of restarting nginx. The configuration is accessible via a special location -handled by . +handled by +. @@ -528,6 +526,39 @@ + +header | last_byte + +upstream +1.7.10 + + +Specifies that a group should use a load balancing method where a request +is passed to the server with the least average response time and +least number of active connections, taking into account weights of servers. +If there are several such servers, they are tried in turn using a +weighted round-robin balancing method. + + + +If the header parameter is specified, +time to receive the +response header is used. +If the last_byte parameter is specified, +time to receive the full response +is used. + + + + +This directive is available as part of our +commercial subscription. + + + + + + [parameters] @@ -836,6 +867,8 @@ cookie name [expires=time] [domain=domain] + [httponly] + [secure] [path=path] route $variable ... @@ -883,23 +916,34 @@ Additional parameters may be as follows: -expires +expires=time -Sets the time for which a browser should keep the cookie. +Sets the time for which a browser should keep the cookie. The special value max will cause the cookie to expire on “31 Dec 2037 23:55:55 GMT”. If the parameter is not specified, it will cause the cookie to expire at the end of a browser session. -domain +domain=domain -Defines the domain for which the cookie is set. +Defines the domain for which the cookie is set. + + +httponly + +Adds the HttpOnly attribute to the cookie (1.7.11). -path +secure -Defines the path for which the cookie is set. +Adds the Secure attribute to the cookie (1.7.11). + + + +path=path + +Defines the path for which the cookie is set. @@ -1032,247 +1076,6 @@ - - - - -location - - -Turns on the HTTP interface of upstream configuration in the surrounding -location. -Access to this location should be -limited. - - - -Configuration commands can be used to: - - -view the group configuration; - -view, modify, or remove a server; - -add a new server. - - - -Since addresses in a group are not required to be unique, specific -servers in a group are referenced by their IDs. -IDs are assigned automatically and shown when adding a new server -or viewing the group configuration. - - - - -A configuration command consists of parameters passed as request arguments, -for example: - -http://127.0.0.1/upstream_conf?upstream=dynamic - - - - -The following parameters are supported: - - - - -upstream=name - -Selects a group to work with. -This parameter is mandatory. - - - -id=number - -Selects a server for viewing, modifying, or removing. - - - -remove= - -Removes a server from the group. - - - -add= - -Adds a new server to the group. - - - -backup= - -Required to add a backup server. - -Before version 1.7.2, backup= -was also required to view, modify, or remove existing backup servers. - - - - -server=address - -Same as the “address” parameter -of the directive. - -When adding a server, it is possible to specify it as a domain name. -In this case, changes of the IP addresses that correspond to a domain name -will be monitored and automatically applied to the upstream -configuration without the need of restarting nginx (1.7.2). -This requires the - directive in the - block. -See also -the parameter of the directive. - - - - -weight=number - -Same as the “weight” parameter -of the directive. - - - -max_conns=number - -Same as the “max_conns” parameter -of the directive. - - - -max_fails=number - -Same as the “max_fails” parameter -of the directive. - - - -fail_timeout=time - -Same as the “fail_timeout” parameter -of the directive. - - - -slow_start=time - -Same as the “slow_start” parameter -of the directive. - - - -down= - -Same as the “down” parameter -of the directive. - - -drain= - -Puts the upstream server in the “draining” mode (1.7.5). -In this mode, only requests bound to the server -will be proxied to it. - - - -up= - -The opposite of the “down” parameter -of the directive. - - - -route=string - -Same as the “route” parameter -of the directive. - - - - -The first two parameters select an object. -This can be either the whole group or a specific server. -Without other parameters, the configuration of the selected -group or server is shown. - - - -For example, to view the configuration of the whole group, send: - -http://127.0.0.1/upstream_conf?upstream=dynamic - - -To view the configuration of a specific server, also specify its ID: - -http://127.0.0.1/upstream_conf?upstream=dynamic&id=42 - - - - -To add a new server, -specify its address in the “server=” parameter. -Without other parameters specified, a server will be added with other -parameters set to their default values (see the directive). - - - -For example, to add a new primary server, send: - -http://127.0.0.1/upstream_conf?add=&upstream=dynamic&server=127.0.0.1:8080 - - -To add a new backup server, send: - -http://127.0.0.1/upstream_conf?add=&upstream=dynamic&backup=&server=127.0.0.1:8080 - - -To add a new primary server, -set its parameters to non-default values -and mark it as “down”, send: - -http://127.0.0.1/upstream_conf?add=&upstream=dynamic&server=127.0.0.1:8080&weight=2&down= - - - - -To remove a server, specify its ID: - -http://127.0.0.1/upstream_conf?remove=&upstream=dynamic&id=42 - - - - -To mark an existing server as “down”, send: - -http://127.0.0.1/upstream_conf?upstream=dynamic&id=42&down= - - -To modify the address of an existing server, send: - -http://127.0.0.1/upstream_conf?upstream=dynamic&id=42&server=192.0.2.3:8123 - - -To modify other parameters of an existing server, send: - -http://127.0.0.1/upstream_conf?upstream=dynamic&id=42&max_fails=3&weight=4 - - - - - - -This directive is available as part of our -commercial subscription. - - - - -
diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/index.xml --- a/xml/en/docs/index.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/en/docs/index.xml Thu Apr 09 19:18:54 2015 +0300 @@ -8,7 +8,7 @@
@@ -405,6 +405,11 @@ + +ngx_http_upstream_conf_module + + + ngx_http_userid_module @@ -477,6 +482,11 @@ + +ngx_stream_ssl_module + + + ngx_stream_upstream_module diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/ngx_core_module.xml --- a/xml/en/docs/ngx_core_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/en/docs/ngx_core_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -10,7 +10,7 @@ + rev="13">
@@ -158,6 +158,7 @@ logs/error.log error main http +stream server location @@ -195,6 +196,12 @@ be built with --with-debug, see “”. + + +The directive can be specified on the +stream level +starting from version 1.7.11. + diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/stream/ngx_stream_core_module.xml --- a/xml/en/docs/stream/ngx_stream_core_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/en/docs/stream/ngx_stream_core_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -9,7 +9,7 @@ + rev="2">
@@ -63,6 +63,7 @@ address:port + [ssl] [bind] [ipv6only=on|off] [so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt]] @@ -94,11 +95,16 @@ -The directive supports the following parameters: +The ssl parameter (1.7.10) allows specifying that all +connections accepted on this port should work in SSL mode. + + +The listen directive +can have several additional parameters specific to socket-related system calls. - + bind @@ -118,7 +124,7 @@ a separate bind call will always be made. - + ipv6only=on|off @@ -130,7 +136,7 @@ It can only be set once on start. - + so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt] @@ -157,6 +163,7 @@ leave the probe interval (TCP_KEEPINTVL) at its system default, and set the probes count (TCP_KEEPCNT) to 10 probes. + @@ -168,6 +175,62 @@ + + + address ... + [valid=time] + [ipv6=on|off] + +stream +server +1.7.10 + + +Configures name servers used to resolve names of upstream servers +into addresses, for example: + +resolver 127.0.0.1 [::1]:5353; + +An address can be specified as a domain name or IP address, +and an optional port. +If port is not specified, the port 53 is used. +Name servers are queried in a round-robin fashion. + + + +By default, nginx will look up both IPv4 and IPv6 addresses while resolving. +If looking up of IPv6 addresses is not desired, +the ipv6=off parameter can be specified. + + + +By default, nginx caches answers using the TTL value of a response. +The optional valid parameter allows overriding it: + +resolver 127.0.0.1 [::1]:5353 valid=30s; + + + + + + + +time +30s +stream +server +1.7.10 + + +Sets a timeout for name resolution, for example: + +resolver_timeout 5s; + + + + + + diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/stream/ngx_stream_proxy_module.xml --- a/xml/en/docs/stream/ngx_stream_proxy_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/en/docs/stream/ngx_stream_proxy_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -9,7 +9,7 @@ + rev="3">
@@ -83,6 +83,59 @@ + +on | off +on +stream +server +1.7.10 + + +When a connection to the proxied server cannot be established, determines +whether a client connection will be passed to the next server. + + + +Passing a connection to the next server can be limited by +the number of tries +and by time. + + + + + + +time +0 +stream +server +1.7.10 + + +Limits the time allowed to pass a connection to the +next server. +The 0 value turns off this limitation. + + + + + + +number +0 +stream +server +1.7.10 + + +Limits the number of possible tries for passing a connection to the +next server. +The 0 value turns off this limitation. + + + + + address @@ -111,6 +164,223 @@ + +on | off +off +stream +server +1.7.10 + + +Enables the SSL/TLS protocol for connections to a proxied server. + + + + + + +file + +stream +server +1.7.10 + + +Specifies a file with the certificate in the PEM format +used for authentication to a proxied server. + + + + + + +file + +stream +server +1.7.10 + + +Specifies a file with the secret key in the PEM format +used for authentication to a proxied server. + + + + + + +ciphers +DEFAULT +stream +server +1.7.10 + + +Specifies the enabled ciphers for connections to a proxied server. +The ciphers are specified in the format understood by the OpenSSL library. + + + +The full list can be viewed using the +“openssl ciphers” command. + + + + + + +file + +stream +server +1.7.10 + + +Specifies a file with revoked certificates (CRL) +in the PEM format used to verify +the certificate of the proxied server. + + + + + + +name +host from proxy_pass +stream +server +1.7.10 + + +Allows to override the server name used to +verify +the certificate of the proxied server and to be +passed through SNI +when establishing a connection with the proxied server. + + + +By default, the host part of the address is used. + + + + + + +file + +stream +server +1.7.10 + + +Specifies a file with passphrases for +secret keys +where each passphrase is specified on a separate line. +Passphrases are tried in turn when loading the key. + + + + + + +on | off +off +stream +server +1.7.10 + + +Enables or disables passing of the server name through +TLS +Server Name Indication extension (SNI, RFC 6066) +when establishing a connection with the proxied server. + + + + + + +on | off +on +stream +server +1.7.10 + + +Determines whether SSL sessions can be reused when working with +the proxied server. +If the errors +“SSL3_GET_FINISHED:digest check failed” +appear in the logs, try disabling session reuse. + + + + + + + + [SSLv2] + [SSLv3] + [TLSv1] + [TLSv1.1] + [TLSv1.2] +SSLv3 TLSv1 TLSv1.1 TLSv1.2 +stream +server +1.7.10 + + +Enables the specified protocols for connections to a proxied server. + + + + + + +file + +stream +server +1.7.10 + + +Specifies a file with trusted CA certificates in the PEM format +used to verify +the certificate of the proxied server. + + + + + + +on | off +off +stream +server +1.7.10 + + +Enables or disables verification of the proxied server certificate. + + + + + + +number +1 +stream +server +1.7.10 + + +Sets the verification depth in the proxied server certificates chain. + + + + + timeout 10m diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/stream/ngx_stream_ssl_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/stream/ngx_stream_ssl_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -0,0 +1,326 @@ + + + + + + + + +
+ + +The ngx_stream_ssl_module module (1.7.10) +provides the necessary support for a stream proxy server to work with +the SSL/TLS protocol. + + + + +This module is available as part of our +commercial subscription. + + + +
+ + +
+ + +file + +stream +server + + +Specifies a file with the certificate in the PEM format for the given +server. +If intermediate certificates should be specified in addition to a primary +certificate, they should be specified in the same file in the following +order: the primary certificate comes first, then the intermediate certificates. +A secret key in the PEM format may be placed in the same file. + + + + + + +file + +stream +server + + +Specifies a file with the secret key in the PEM format for the given +server. + + + + + + +ciphers +HIGH:!aNULL:!MD5 +stream +server + + +Specifies the enabled ciphers. +The ciphers are specified in the format understood by the +OpenSSL library, for example: + +ssl_ciphers ALL:!aNULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; + + + + +The full list can be viewed using the +“openssl ciphers” command. + + + + + + +file + +stream +server + + +Specifies a file with DH parameters for EDH ciphers. + + + + + + +curve +prime256v1 +stream +server + + +Specifies a curve for ECDHE ciphers. + + + + + + +time +60s +stream +server + + +Specifies a timeout for the SSL handshake to complete. + + + + + + +file + +stream +server + + +Specifies a file with passphrases for +secret keys +where each passphrase is specified on a separate line. +Passphrases are tried in turn when loading the key. + + + +Example: + +stream { + ssl_password_file /etc/keys/global.pass; + ... + + server { + listen 127.0.0.1:12345; + ssl_certificate_key /etc/keys/first.key; + } + + server { + listen 127.0.0.1:12346; + + # named pipe can also be used instead of a file + ssl_password_file /etc/keys/fifo; + ssl_certificate_key /etc/keys/second.key; + } +} + + + + + + + +on | off +off +stream +server + + +Specifies that server ciphers should be preferred over client ciphers +when the SSLv3 and TLS protocols are used. + + + + + + + + [SSLv2] + [SSLv3] + [TLSv1] + [TLSv1.1] + [TLSv1.2] +SSLv3 TLSv1 TLSv1.1 TLSv1.2 +stream +server + + +Enables the specified protocols. +The TLSv1.1 and TLSv1.2 parameters work +only when the OpenSSL library of version 1.0.1 or higher is used. + + + + + + + + off | + none | + [builtin[:size]] + [shared:name:size] +none +stream +server + + +Sets the types and sizes of caches that store session parameters. +A cache can be of any of the following types: + + +off + +the use of a session cache is strictly prohibited: +nginx explicitly tells a client that sessions may not be reused. + + +none + +the use of a session cache is gently disallowed: +nginx tells a client that sessions may be reused, but does not +actually store session parameters in the cache. + + +builtin + +a cache built in OpenSSL; used by one worker process only. +The cache size is specified in sessions. +If size is not given, it is equal to 20480 sessions. +Use of the built-in cache can cause memory fragmentation. + + +shared + +a cache shared between all worker processes. +The cache size is specified in bytes; one megabyte can store +about 4000 sessions. +Each shared cache should have an arbitrary name. +A cache with the same name can be used in several +servers. + + + + + + +Both cache types can be used simultaneously, for example: + +ssl_session_cache builtin:1000 shared:SSL:10m; + +but using only shared cache without the built-in cache should +be more efficient. + + + + + + +file + +stream +server + + +Sets a file with the secret key used to encrypt +and decrypt TLS session tickets. +The directive is necessary if the same key has to be shared between +multiple servers. +By default, a randomly generated key is used. + + + +If several keys are specified, only the first key is +used to encrypt TLS session tickets. +This allows configuring key rotation, for example: + +ssl_session_ticket_key current.key; +ssl_session_ticket_key previous.key; + + + + +The file must contain 48 bytes of random data and can +be created using the following command: + +openssl rand 48 > ticket.key + + + + + + + +on | off +on +stream +server + + +Enables or disables session resumption through +TLS session tickets. + + + + + + +time +5m +stream +server + + +Specifies a time during which a client may reuse the +session parameters stored in a cache. + + + + +
+ +
diff -r c79501e16e26 -r f5b5eefc43cb xml/en/docs/stream/ngx_stream_upstream_module.xml --- a/xml/en/docs/stream/ngx_stream_upstream_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/en/docs/stream/ngx_stream_upstream_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -9,7 +9,7 @@ + rev="5">
@@ -34,17 +34,23 @@ +resolver 10.0.0.1; + upstream backend { + zone upstream_backend 64k; + 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 unix:/tmp/backend2; + server backend3.example.com:12345 resolve; } server { listen 12346; proxy_pass backend; + health_check; } @@ -72,7 +78,8 @@ upstream backend { server backend1.example.com:12345 weight=5; server 127.0.0.1:12345 max_fails=3 fail_timeout=30s; - server unix:/tmp/backend3; + server unix:/tmp/backend2; + server backend3.example.com:12345 resolve; server backup1.example.com:12345 backup; } @@ -179,6 +186,34 @@ Default value is zero, meaning there is no limit. + +resolve + + +monitors changes of the IP addresses +that correspond to a domain name of the server, +and automatically modifies the upstream configuration +without the need of restarting nginx (1.7.10). + +In order for this parameter to work, +the directive +must be specified in the + block. +Example: + +stream { + resolver 10.0.0.1; + + upstream u { + zone ...; + ... + server example.com:12345 resolve; + } +} + + + + slow_start=time @@ -204,6 +239,27 @@ + +name size + +upstream +1.7.10 + + +Defines the name and size of the shared +memory zone that keeps the group’s configuration and run-time state that are +shared between worker processes. +Such groups allow changing the group membership +or modifying the settings of a particular server +without the need of restarting nginx. +The configuration is accessible via a special location +handled by +. + + + + + key [consistent] @@ -253,6 +309,229 @@ + + +connect | + first_byte | + last_byte + +upstream +1.7.11 + + +Specifies that a group should use a load balancing method where a connection +is passed to the server with the least average time and +least number of active connections, taking into account weights of servers. +If there are several such servers, they are tried in turn using a +weighted round-robin balancing method. + + + +If the connect parameter is specified, +time to connect to the upstream server is used. +If the first_byte parameter is specified, +time to receive the first byte of data is used. +If the last_byte is specified, +time to receive the last byte of data is used. + + + + + + +[parameters] + +server +1.7.10 + + +Enables periodic health checks of the servers in a +group. + + + +The following optional parameters are supported: + + + +interval=time + + +sets the interval between two consecutive health checks, +by default, 5 seconds; + + + +fails=number + + +sets the number of consecutive failed health checks of a particular server +after which this server will be considered unhealthy, +by default, 1; + + + +passes=number + + +sets the number of consecutive passed health checks of a particular server +after which the server will be considered healthy, +by default, 1; + + + +match=name + + +specifies the match block configuring the tests that a +successful connection should pass in order for a health check to pass; +by default, only the ability to connect to the server is checked. + + + + + + +For example, + +server { + proxy_pass backend; + health_check; +} + +will check the ability to connect to each +server in the backend group every five seconds. +When a connection to the server cannot be established, +the health check will fail, and the server will +be considered unhealthy. +Client connections are not passed to unhealthy servers. + + + +Health checks can also be configured to test data obtained from the server. +Tests are configured separately using the directive +and referenced in the match parameter. + + + +The server group must reside in the shared memory. + + + +If several health checks are defined for the same group of servers, +a single failure of any check will make the corresponding server be +considered unhealthy. + + + + + + +timeout +5s +stream +server +1.7.10 + + +Overrides the + +value for health checks. + + + + + + +name + +stream +1.7.10 + + +Defines the named test set used to verify server responses to health checks. + + + +The following parameters can be configured: + + + +send string; + + +sends a string to the server; + + + +expect ~ regexp; + + +a regular expression that the data obtained from the server should match. +The regular expression is specified with the preceding +“~*” modifier (for case-insensitive matching), or the +“~” modifier (for case-sensitive matching). + + + + + + +Health check is passed if: + + +the connection was successfully established; + + + +the string from the send parameter, +if specified, was sent; + + + +the data obtained from the server matched the regular expression +from the expect parameter, if specified; + + + +the time elapsed does not exceed the value specified +in the directive. + + + + + + +Example: + +upstream backend { + zone upstream_backend 10m; + server 127.0.0.1:12345; +} + +match http { + send "GET / HTTP/1.0\r\nHost: localhost\r\n\r\n"; + expect ~ "200 OK"; +} + +server { + listen 12346; + proxy_pass backend; + health_check match=http; +} + + + + + +Only the first + +bytes of data obtained from the server are examined. + + + + +
diff -r c79501e16e26 -r f5b5eefc43cb xml/ru/GNUmakefile --- a/xml/ru/GNUmakefile Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/ru/GNUmakefile Thu Apr 09 19:18:54 2015 +0300 @@ -70,6 +70,7 @@ http/ngx_http_stub_status_module \ http/ngx_http_sub_module \ http/ngx_http_upstream_module \ + http/ngx_http_upstream_conf_module \ http/ngx_http_userid_module \ http/ngx_http_uwsgi_module \ http/ngx_http_xslt_module \ diff -r c79501e16e26 -r f5b5eefc43cb xml/ru/docs/http/ngx_http_status_module.xml --- a/xml/ru/docs/http/ngx_http_status_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/ru/docs/http/ngx_http_status_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -9,7 +9,7 @@ + rev="5">
@@ -160,7 +160,7 @@ version Версия предоставляемого набора данных. -Текущей является версия 4. +Текущей является версия 5. nginx_version @@ -173,6 +173,13 @@ Адрес сервера, принявшего запрос получения информации о состоянии. +generation + +Суммарное число +перезагрузок +конфигурации. + + load_timestamp Время последней перезагрузки конфигурации, в миллисекундах с начала эпохи. @@ -183,6 +190,19 @@ Текущее время в миллисекундах с начала эпохи. +processes + + + +respawned + +Суммарное число перезапусков аварийно завершённых +дочерних процессов. + + + + + connections @@ -331,11 +351,13 @@ Текущее число активных соединений. + max_conns @@ -451,6 +473,24 @@ когда сервер в последний раз был выбран для обработки запроса (1.7.5). +header_time + +Среднее время получения +заголовка +ответа от сервера (1.7.10). +Поле доступно при использовании метода балансировки +. + + +response_time + +Среднее время получения +всего +ответа от сервера (1.7.10). +Поле доступно при использовании метода балансировки +. + + @@ -551,6 +591,28 @@ +Поле keepalive сервера группы +было удалено в версии 5. + + + +Поле +было добавлено в версии 5. + + + +Поле в + +было добавлено в версии 5. + + + +Поля и в + +были добавлены в версии 5. + + + Поле в было добавлено в версии 4. diff -r c79501e16e26 -r f5b5eefc43cb xml/ru/docs/http/ngx_http_upstream_conf_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/ru/docs/http/ngx_http_upstream_conf_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -0,0 +1,333 @@ + + + + + + + + +
+ + +Модуль ngx_http_upstream_conf_module +позволяет оперативно настраивать группы серверов +при помощи простого HTTP-интерфейса без необходимости перезапуска nginx. +Группа серверов +http +или +stream +должна находиться в разделяемой памяти. + + +
+ + +
+ + + +upstream backend { + zone upstream_backend 64k; + + ... +} + +server { + location /upstream_conf { + upstream_conf; + allow 127.0.0.1; + deny all; + } +} + + + +
+ + +
+ + + + +location + + +Активирует HTTP-интерфейс для настройки групп серверов в содержащем location. +Доступ в location следует +ограничить. + + + +С помощью команд настройки можно: + + +просматривать конфигурацию группы; + + +просматривать или изменять конфигурацию, а также +удалять серверы; + + +добавлять новые серверы. + + + +Поскольку адреса в группе не обязаны быть уникальными, +обращение к отдельным серверам в группе осуществляется по их идентификаторам. +Идентификаторы назначаются автоматически и показываются при добавлении сервера +или просмотре конфигурации группы. + + + + +Команда настройки состоит из параметров, передаваемых в аргументах запроса, +например: + +http://127.0.0.1/upstream_conf?upstream=backend + + + + +Поддерживаются следующие параметры: + + + + +stream= + +Выбирает группу серверов +stream. +Если параметр не задан, будет выбрана группа серверов +http. + + + +upstream=имя + +Выбирает группу серверов для работы. +Параметр является обязательным. + + + +id=число + +Выбирает сервер для просмотра, изменения или удаления. + + + +remove= + +Удаляет сервер из группы. + + + +add= + +Добавляет новый сервер в группу. + + + +backup= + +Необходим для добавления запасного сервера. + +До версии 1.7.2 параметр backup= требовался +также для просмотра, изменения или удаления существующих запасных серверов. + + + + +server=адрес + +То же, что и параметр “адрес” сервера группы +http +или +stream. + +При добавлении сервер можно задать в виде доменного имени. +В этом случае любые изменения IP-адресов, соответствующих доменному имени +сервера, отслеживаются и автоматически применяются к конфигурации группы +без необходимости перезапуска nginx (1.7.2). +Для этого в блоке +http +или +stream +должна быть задана директива “resolver”. +См. также параметр “resolve” сервера группы +http +или +stream. + + + + +weight=число + +То же, что и параметр “weight” сервера группы +http +или +stream. + + + +max_conns=число + +То же, что и параметр “max_conns” сервера группы +http +или +stream. + + + +max_fails=число + +То же, что и параметр “max_fails” сервера группы +http +или +stream. + + + +fail_timeout=время + +То же, что и параметр “fail_timeout” сервера группы +http +или +stream. + + + +slow_start=время + +То же, что и параметр “slow_start” сервера группы +http +или +stream. + + + +down= + +То же, что и параметр “down” сервера группы +http +или +stream. + + +drain= + +Переводит сервер группы серверов +http +в режим “draining” (1.7.5). +В этом режиме на сервер будут проксироваться только +привязанные +к нему запросы. + + + +up= + +Параметр, обратный по значению параметру “down” сервера группы +http +или +stream. + + + +route=строка + +То же, что и параметр “route” сервера группы +http. + + + + +Первые три параметра выбирают объект. +Объектом может быть либо группа серверов http или stream, +либо отдельный сервер. +Если остальные параметры не указаны, то показывается конфигурация выбранной +группы или сервера. + + + +Например, команда для просмотра конфигурации всей группы +выглядит следующим образом: + +http://127.0.0.1/upstream_conf?upstream=backend + + +Для просмотра конфигурации отдельного сервера следует указать его идентификатор: + +http://127.0.0.1/upstream_conf?upstream=backend&id=42 + + + + +Для добавления нового сервера в группу +следует указать его адрес в параметре “server=”. +Если остальные параметры не указаны, то при добавлении сервера +их значения будут установлены по умолчанию (см. директиву +“server” для +http +или +stream). + + + +Например, команда для добавления нового основного сервера в группу +выглядит следующим образом: + +http://127.0.0.1/upstream_conf?add=&upstream=backend&server=127.0.0.1:8080 + + +Добавление нового запасного сервера происходит следующим образом: + +http://127.0.0.1/upstream_conf?add=&upstream=backend&backup=&server=127.0.0.1:8080 + + +Добавление нового основного сервера с нестандартными +значениями параметров и с пометкой его как постоянно недоступного +(“down”) происходит следующим образом: + +http://127.0.0.1/upstream_conf?add=&upstream=backend&server=127.0.0.1:8080&weight=2&down= + + +Для удаления сервера следует указать его идентификатор: + +http://127.0.0.1/upstream_conf?remove=&upstream=backend&id=42 + + +Пометка существующего сервера как постоянно недоступного +(“down”) происходит следующим образом: + +http://127.0.0.1/upstream_conf?upstream=backend&id=42&down= + + +Изменение адреса существующего сервера происходит следующим образом: + +http://127.0.0.1/upstream_conf?upstream=backend&id=42&server=192.0.2.3:8123 + + +Изменение других параметров существующего сервера происходит следующим образом: + +http://127.0.0.1/upstream_conf?upstream=backend&id=42&max_fails=3&weight=4 + + +Вышеприведённые примеры актуальны для группы серверов +http. +Аналогичные примеры для группы серверов +stream +требуют указания параметра “stream=”. + + + + +
+ +
diff -r c79501e16e26 -r f5b5eefc43cb xml/ru/docs/http/ngx_http_upstream_module.xml --- a/xml/ru/docs/http/ngx_http_upstream_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/ru/docs/http/ngx_http_upstream_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -10,7 +10,7 @@ + rev="36">
@@ -54,12 +54,15 @@ доступна как часть коммерческой подписки: +resolver 10.0.0.1; + upstream dynamic { zone upstream_dynamic 64k; server backend1.example.com weight=5; server backend2.example.com:8080 fail_timeout=5s slow_start=30s; server 192.0.2.1 max_fails=3; + server backend3.example.com resolve; server backup1.example.com:8080 backup; server backup2.example.com:8080 backup; @@ -70,12 +73,6 @@ proxy_pass http://dynamic; health_check; } - - location /upstream_conf { - upstream_conf; - allow 127.0.0.1; - deny all; - } } @@ -299,7 +296,8 @@ или настроек отдельных серверов нет необходимости перезапускать nginx. Конфигурация доступна через специальный location, -в котором указана директива . +в котором указана директива +. @@ -533,6 +531,38 @@ + +header | last_byte + +upstream +1.7.10 + + +Задаёт для группы метод балансировки нагрузки, при котором запрос +передаётся серверу с наименьшими средним временем ответа и +числом активных соединений с учётом весов серверов. +Если подходит сразу несколько серверов, то они выбираются циклически +(в режиме round-robin) с учётом их весов. + + + +Если указан параметр header, +то учитывается время получения +заголовка ответа. +Если указан параметр last_byte, то учитывается +время получения всего ответа. + + + + +Эта директива доступна как часть +коммерческой подписки. + + + + + + [параметры] @@ -842,6 +872,8 @@ cookie имя [expires=время] [domain=домен] + [httponly] + [secure] [path=путь] route переменная ... @@ -889,22 +921,32 @@ Дополнительные параметры могут быть следующими: -expires +expires=время -Задаёт время, в течение которого браузеру необходимо хранить куку. +Задаёт время, в течение которого браузеру необходимо хранить куку. Специальное значение max устанавливает срок хранения куки до 31 декабря 2037 года 23:55:55 GMT. Если параметр не указан, то время действия куки ограничивается сессией браузера. -domain +domain=домен -Задаёт домен, для которого устанавливается кука. +Задаёт домен, для которого устанавливается кука. -path +httponly + +Добавляет атрибут HttpOnly к куке (1.7.11). + + +secure -Задаёт путь, для которого устанавливается кука. +Добавляет атрибут Secure к куке (1.7.11). + + +path=путь + +Задаёт путь, для которого устанавливается кука. @@ -1038,253 +1080,6 @@ - - - - -location - - -Активирует HTTP-интерфейс для настройки групп серверов в содержащем location. -Доступ в location следует -ограничить. - - - -С помощью команд настройки можно: - - -просматривать конфигурацию группы; - - -просматривать или изменять конфигурацию, а также -удалять серверы; - - -добавлять новые серверы. - - - -Поскольку адреса в группе не обязаны быть уникальными, -обращение к отдельным серверам в группе осуществляется по их идентификаторам. -Идентификаторы назначаются автоматически и показываются при добавлении сервера -или просмотре конфигурации группы. - - - - -Команда настройки состоит из параметров, передаваемых в аргументах запроса, -например: - -http://127.0.0.1/upstream_conf?upstream=dynamic - - - - -Поддерживаются следующие параметры: - - - - -upstream=имя - -Выбирает группу серверов для работы. -Параметр является обязательным. - - - -id=число - -Выбирает сервер для просмотра, изменения или удаления. - - - -remove= - -Удаляет сервер из группы. - - - -add= - -Добавляет новый сервер в группу. - - - -backup= - -Необходим для добавления запасного сервера. - -До версии 1.7.2 параметр backup= требовался -также для просмотра, изменения или удаления существующих запасных серверов. - - - - -server=адрес - -То же, что и параметр “адрес” -директивы . - -При добавлении сервер можно задать в виде доменного имени. -В этом случае любые изменения IP-адресов, соответствующих доменному имени -сервера, отслеживаются и автоматически применяются к конфигурации группы -без необходимости перезапуска nginx (1.7.2). -Для этого в блоке должна -быть задана директива . -См. также параметр - директивы . - - - - -weight=число - -То же, что и параметр “weight” -директивы . - - - -max_conns=число - -То же, что и параметр “max_conns” -директивы . - - - -max_fails=число - -То же, что и параметр “max_fails” -директивы . - - - -fail_timeout=время - -То же, что и параметр “fail_timeout” -директивы . - - - -slow_start=время - -То же, что и параметр “slow_start” -директивы . - - - -down= - -То же, что и параметр “down” -директивы . - - -drain= - - -Переводит сервер группы в режим “draining” (1.7.5). -В этом режиме на сервер будут проксироваться только -привязанные к нему запросы. - - - -up= - -Параметр, обратный по значению параметру “down” -директивы . - - - -route=строка - -То же, что и параметр “route” -директивы . - - - - -Первые два параметра выбирают объект. -Объектом может быть либо группа серверов, либо отдельный сервер. -Если остальные параметры не указаны, то показывается конфигурация выбранной -группы или сервера. - - - -Например, команда для просмотра конфигурации всей группы -выглядит следующим образом: - -http://127.0.0.1/upstream_conf?upstream=dynamic - - -Для просмотра конфигурации отдельного сервера следует указать его идентификатор: - -http://127.0.0.1/upstream_conf?upstream=dynamic&id=42 - - - - - -Для добавления нового сервера в группу -следует указать его адрес в параметре “server=”. -Если остальные параметры не указаны, то при добавлении сервера -их значения будут установлены по умолчанию (см. директиву ). - - - -Например, команда для добавления нового основного сервера в группу -выглядит следующим образом: - -http://127.0.0.1/upstream_conf?add=&upstream=dynamic&server=127.0.0.1:8080 - - -Добавление нового запасного сервера происходит следующим образом: - -http://127.0.0.1/upstream_conf?add=&upstream=dynamic&backup=&server=127.0.0.1:8080 - - -Добавление нового основного сервера с нестандартными -значениями параметров и с пометкой его как постоянно недоступного -(“down”) происходит следующим образом: - -http://127.0.0.1/upstream_conf?add=&upstream=dynamic&server=127.0.0.1:8080&weight=2&down= - - - - -Для удаления сервера следует указать его идентификатор: - -http://127.0.0.1/upstream_conf?remove=&upstream=dynamic&id=42 - - - - -Пометка существующего сервера как постоянно недоступного -(“down”) происходит следующим образом: - -http://127.0.0.1/upstream_conf?upstream=dynamic&id=42&down= - - -Изменение адреса существующего сервера происходит следующим образом: - -http://127.0.0.1/upstream_conf?upstream=dynamic&id=42&server=192.0.2.3:8123 - - -Изменение других параметров существующего сервера происходит следующим образом: - -http://127.0.0.1/upstream_conf?upstream=dynamic&id=42&max_fails=3&weight=4 - - - - - - -Эта директива доступна как часть -коммерческой подписки. - - - - -
diff -r c79501e16e26 -r f5b5eefc43cb xml/ru/docs/index.xml --- a/xml/ru/docs/index.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/ru/docs/index.xml Thu Apr 09 19:18:54 2015 +0300 @@ -8,7 +8,7 @@
@@ -409,6 +409,11 @@ + +ngx_http_upstream_conf_module + + + ngx_http_userid_module diff -r c79501e16e26 -r f5b5eefc43cb xml/ru/docs/ngx_core_module.xml --- a/xml/ru/docs/ngx_core_module.xml Wed Apr 08 13:56:52 2015 +0300 +++ b/xml/ru/docs/ngx_core_module.xml Thu Apr 09 19:18:54 2015 +0300 @@ -10,7 +10,7 @@ + rev="13">
@@ -158,6 +158,7 @@ logs/error.log error main http +stream server location @@ -194,6 +195,12 @@ nginx с --with-debug, см. “”. + + +Директива может быть указана на +уровне stream +начиная с версии 1.7.11. +