{{tag>nginx webserver docker proxy}}
====== 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 ======
* [[wiki:proxying_dns_name_local_service|Proxying DNS name to local service]]
* [[https://stackoverflow.com/questions/63364678/with-nginx-upstreams-is-it-possible-to-proxy-pass-to-both-http-and-https-backen|proxy pass to both HTTP and HTTPS backends in the same upstream]]
====== References ======