How to configure nginx fort UDP and TCP

Francis Daly francis at
Mon Feb 15 23:17:26 UTC 2021

On Tue, Feb 09, 2021 at 04:43:28AM -0500, bibi93 wrote:

Hi there,

> I would like to put 4 server behind one NGINX server. these servers are not
> WEB sites but for deployment of packages, supervision, antivirus. therefore
> we do not access sites. So these are servers that discuss with other servers
> by agent bias under TCP and UDP ports.

It sounds like you may want to use the nginx "stream" module, which has
documentation and some examples at

> Is it possible to make these agents call an alias to a public IP which would
> be the NGINX server which would dispatch the flows according to the alias
> called to the servers in question only with the defined ports

Note that you will probably need to distinguish your back-end servers
by TCP or UDP port, because the nginx server will not (in general)
know which hostname the client used originally; nginx will know which
IP address and port it connected to.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list