User Tools

Site Tools


wiki:proxy_non_http_traffic_through_nginx

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

  • Debian 11
  • nginx/1.21.6

See also

References

wiki/proxy_non_http_traffic_through_nginx.txt · Last modified: 2022/02/28 16:10 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki