Edit: The purpose of this was to only allow UDP connections to a specific port of it used a specific sub domain. I’ve now learned udp doesn’t have a concept of subdomains, making this entire question pointless.

I have nginx running on the host, and a program I want to proxy running in a docker container. How do I configure nginx to redirect traffic from a specific subdomain to that container? I can't find any examples for that setup, only both on the host or both in docker containers. I've used proxy_pass before, but only for both on the host. Also, I'd prefer not to publish the IP from the docker container to the host; I'd rather let nginx do the forwarding.

1 Answers

Community On

This config should work:

server {
    listen       80;
    server_name  subdomain.domain.tld;
    location / {
        proxy_pass http://<IP of Docker Container>:<port>;