view xml/en/docs/stream/ngx_stream_proxy_module.xml @ 2083:fb5eef3637a4

Avoid double negative in if_not_empty. Use of "not" and "until" in the same sentence makes it confusing. Moreover, use of "until" with something that doesn't describe an event or point in time is wrong.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 11 Dec 2017 19:15:31 +0300
parents 8f1a568a8bbf
children a9a9a052b5bd
line wrap: on
line source

<?xml version="1.0"?>

<!--
  Copyright (C) Nginx, Inc.
  -->

<!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">

<module name="Module ngx_stream_proxy_module"
        link="/en/docs/stream/ngx_stream_proxy_module.html"
        lang="en"
        rev="18">

<section id="summary">

<para>
The <literal>ngx_stream_proxy_module</literal> module (1.9.0) allows proxying
data streams over TCP, UDP (1.9.13), and UNIX-domain sockets.
</para>

</section>


<section id="example" name="Example Configuration">

<para>
<example>
server {
    listen 127.0.0.1:12345;
    proxy_pass 127.0.0.1:8080;
}

server {
    listen 12345;
    proxy_connect_timeout 1s;
    proxy_timeout 1m;
    proxy_pass example.com:12345;
}

server {
    listen 53 udp;
    proxy_responses 1;
    proxy_timeout 20s;
    proxy_pass dns.example.com:53;
}

server {
    listen [::1]:12345;
    proxy_pass unix:/tmp/stream.socket;
}
</example>
</para>

</section>


<section id="directives" name="Directives">

<directive name="proxy_bind">
<syntax>
    <value>address</value>
    [<literal>transparent</literal>] |
    <literal>off</literal></syntax>
<default/>
<context>stream</context>
<context>server</context>
<appeared-in>1.9.2</appeared-in>

<para>
Makes outgoing connections to a proxied server originate
from the specified local IP <value>address</value>.
Parameter value can contain variables (1.11.2).
The special value <literal>off</literal> cancels the effect
of the <literal>proxy_bind</literal> directive
inherited from the previous configuration level, which allows the
system to auto-assign the local IP address.
</para>

<para id="proxy_bind_transparent">
The <literal>transparent</literal> parameter (1.11.0) allows
outgoing connections to a proxied server originate
from a non-local IP address,
for example, from a real IP address of a client:
<example>
proxy_bind $remote_addr transparent;
</example>
In order for this parameter to work,
it is necessary to run nginx worker processes with the
<link doc="../ngx_core_module.xml" id="user">superuser</link> privileges
and configure kernel routing table
to intercept network traffic from the proxied server.
</para>

</directive>


<directive name="proxy_buffer_size">
<syntax><value>size</value></syntax>
<default>16k</default>
<context>stream</context>
<context>server</context>
<appeared-in>1.9.4</appeared-in>

<para>
Sets the <value>size</value> of the buffer used for reading data
from the proxied server.
Also sets the <value>size</value> of the buffer used for reading data
from the client.
</para>

</directive>


<directive name="proxy_connect_timeout">
<syntax><value>time</value></syntax>
<default>60s</default>
<context>stream</context>
<context>server</context>

<para>
Defines a timeout for establishing a connection with a proxied server.
</para>

</directive>


<directive name="proxy_download_rate">
<syntax><value>rate</value></syntax>
<default>0</default>
<context>stream</context>
<context>server</context>
<appeared-in>1.9.3</appeared-in>

<para>
Limits the speed of reading the data from the proxied server.
The <value>rate</value> is specified in bytes per second.
The zero value disables rate limiting.
The limit is set per a connection, so if nginx simultaneously opens
two connections to the proxied server,
the overall rate will be twice as much as the specified limit.
</para>

</directive>


<directive name="proxy_next_upstream">
<syntax><literal>on</literal> | <literal>off</literal></syntax>
<default>on</default>
<context>stream</context>
<context>server</context>

<para>
When a connection to the proxied server cannot be established, determines
whether a client connection will be passed to the next server.
</para>

<para>
Passing a connection to the next server can be limited by
<link id="proxy_next_upstream_tries">the number of tries</link>
and by <link id="proxy_next_upstream_timeout">time</link>.
</para>

</directive>


<directive name="proxy_next_upstream_timeout">
<syntax><value>time</value></syntax>
<default>0</default>
<context>stream</context>
<context>server</context>

<para>
Limits the time allowed to pass a connection to the
<link id="proxy_next_upstream">next server</link>.
The <literal>0</literal> value turns off this limitation.
</para>

</directive>


<directive name="proxy_next_upstream_tries">
<syntax><value>number</value></syntax>
<default>0</default>
<context>stream</context>
<context>server</context>

<para>
Limits the number of possible tries for passing a connection to the
<link id="proxy_next_upstream">next server</link>.
The <literal>0</literal> value turns off this limitation.
</para>

</directive>


<directive name="proxy_pass">
<syntax><value>address</value></syntax>
<default/>
<context>server</context>

<para>
Sets the address of a proxied server.
The address can be specified as a domain name or IP address,
and a port:
<example>
proxy_pass localhost:12345;
</example>
or as a UNIX-domain socket path:
<example>
proxy_pass unix:/tmp/stream.socket;
</example>
</para>

<para>
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
<link doc="ngx_stream_upstream_module.xml">server group</link>.
</para>

<para>
The address can also be specified using variables (1.11.3):
<example>
proxy_pass $upstream;
</example>
In this case, the server name is searched among the described
<link doc="ngx_stream_upstream_module.xml">server groups</link>,
and, if not found, is determined using a
<link doc="ngx_stream_core_module.xml" id="resolver"/>.
</para>

</directive>


<directive name="proxy_protocol">
<syntax><literal>on</literal> | <literal>off</literal></syntax>
<default>off</default>
<context>stream</context>
<context>server</context>
<appeared-in>1.9.2</appeared-in>

<para>
Enables the
<link url="http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt">PROXY
protocol</link> for connections to a proxied server.
</para>

</directive>


<directive name="proxy_responses">
<syntax><value>number</value></syntax>
<default/>
<context>stream</context>
<context>server</context>
<appeared-in>1.9.13</appeared-in>

<para>
Sets the number of datagrams expected from the proxied server
in response to the client request
if the <link doc="ngx_stream_core_module.xml" id="udp">UDP</link>
protocol is used.
By default, the number of datagrams is not limited:
the response datagrams will be sent
until the <link id="proxy_timeout"/> value expires.
</para>

</directive>


<directive name="proxy_ssl">
<syntax><literal>on</literal> | <literal>off</literal></syntax>
<default>off</default>
<context>stream</context>
<context>server</context>

<para>
Enables the SSL/TLS protocol for connections to a proxied server.
</para>

</directive>


<directive name="proxy_ssl_certificate">
<syntax><value>file</value></syntax>
<default/>
<context>stream</context>
<context>server</context>

<para>
Specifies a <value>file</value> with the certificate in the PEM format
used for authentication to a proxied server.
</para>

</directive>


<directive name="proxy_ssl_certificate_key">
<syntax><value>file</value></syntax>
<default/>
<context>stream</context>
<context>server</context>

<para>
Specifies a <value>file</value> with the secret key in the PEM format
used for authentication to a proxied server.
</para>

</directive>


<directive name="proxy_ssl_ciphers">
<syntax><value>ciphers</value></syntax>
<default>DEFAULT</default>
<context>stream</context>
<context>server</context>

<para>
Specifies the enabled ciphers for connections to a proxied server.
The ciphers are specified in the format understood by the OpenSSL library.
</para>

<para>
The full list can be viewed using the
“<command>openssl ciphers</command>” command.
</para>

</directive>


<directive name="proxy_ssl_crl">
<syntax><value>file</value></syntax>
<default/>
<context>stream</context>
<context>server</context>

<para>
Specifies a <value>file</value> with revoked certificates (CRL)
in the PEM format used to <link id="proxy_ssl_verify">verify</link>
the certificate of the proxied server.
</para>

</directive>


<directive name="proxy_ssl_name">
<syntax><value>name</value></syntax>
<default>host from proxy_pass</default>
<context>stream</context>
<context>server</context>

<para>
Allows overriding the server name used to
<link id="proxy_ssl_verify">verify</link>
the certificate of the proxied server and to be
<link id="proxy_ssl_server_name">passed through SNI</link>
when establishing a connection with the proxied server.
The server name can also be specified using variables (1.11.3).
</para>

<para>
By default, the host part of the <link id="proxy_pass"/> address is used.
</para>

</directive>


<directive name="proxy_ssl_password_file">
<syntax><value>file</value></syntax>
<default/>
<context>stream</context>
<context>server</context>

<para>
Specifies a <value>file</value> with passphrases for
<link id="proxy_ssl_certificate_key">secret keys</link>
where each passphrase is specified on a separate line.
Passphrases are tried in turn when loading the key.
</para>

</directive>


<directive name="proxy_ssl_server_name">
<syntax><literal>on</literal> | <literal>off</literal></syntax>
<default>off</default>
<context>stream</context>
<context>server</context>

<para>
Enables or disables passing of the server name through
<link url="http://en.wikipedia.org/wiki/Server_Name_Indication">TLS
Server Name Indication extension</link> (SNI, RFC 6066)
when establishing a connection with the proxied server.
</para>

</directive>


<directive name="proxy_ssl_session_reuse">
<syntax><literal>on</literal> | <literal>off</literal></syntax>
<default>on</default>
<context>stream</context>
<context>server</context>

<para>
Determines whether SSL sessions can be reused when working with
the proxied server.
If the errors
“<literal>SSL3_GET_FINISHED:digest check failed</literal>”
appear in the logs, try disabling session reuse.
</para>

</directive>


<directive name="proxy_ssl_protocols">
<syntax>
    [<literal>SSLv2</literal>]
    [<literal>SSLv3</literal>]
    [<literal>TLSv1</literal>]
    [<literal>TLSv1.1</literal>]
    [<literal>TLSv1.2</literal>]
    [<literal>TLSv1.3</literal>]</syntax>
<default>TLSv1 TLSv1.1 TLSv1.2</default>
<context>stream</context>
<context>server</context>

<para>
Enables the specified protocols for connections to a proxied server.
</para>

</directive>


<directive name="proxy_ssl_trusted_certificate">
<syntax><value>file</value></syntax>
<default/>
<context>stream</context>
<context>server</context>

<para>
Specifies a <value>file</value> with trusted CA certificates in the PEM format
used to <link id="proxy_ssl_verify">verify</link>
the certificate of the proxied server.
</para>

</directive>


<directive name="proxy_ssl_verify">
<syntax><literal>on</literal> | <literal>off</literal></syntax>
<default>off</default>
<context>stream</context>
<context>server</context>

<para>
Enables or disables verification of the proxied server certificate.
</para>

</directive>


<directive name="proxy_ssl_verify_depth">
<syntax><value>number</value></syntax>
<default>1</default>
<context>stream</context>
<context>server</context>

<para>
Sets the verification depth in the proxied server certificates chain.
</para>

</directive>


<directive name="proxy_timeout">
<syntax><value>timeout</value></syntax>
<default>10m</default>
<context>stream</context>
<context>server</context>

<para>
Sets the <value>timeout</value> between two successive
read or write operations on client or proxied server connections.
If no data is transmitted within this time, the connection is closed.
</para>

</directive>


<directive name="proxy_upload_rate">
<syntax><value>rate</value></syntax>
<default>0</default>
<context>stream</context>
<context>server</context>
<appeared-in>1.9.3</appeared-in>

<para>
Limits the speed of reading the data from the client.
The <value>rate</value> is specified in bytes per second.
The zero value disables rate limiting.
The limit is set per a connection, so if the client simultaneously opens
two connections,
the overall rate will be twice as much as the specified limit.
</para>

</directive>

</section>

</module>