Table of Contents

, , ,

Proxy non-http traffic through nginx

Example if you have a docker container running and it is listening for UDP traffic.

Make sure nginx.conf includes the following at the end of file:

stream {
        include /etc/nginx/streams-enabled/*;
}

Then in streams-enabled directory above make a file with defined server and ports. For example if the docker container exposes a UDP service on port 12201 and this is binded on the host machine at localhost port 12201, configuration should look like this:

server {
    listen server1.example.com:12201;
	proxy_pass 127.0.0.1:12201;
}
 
server {
    ...
 

You can include multiple server directives for each port/service that need to be accessible.

Tested on

See also

References