nginx as a docker upstream proxy with maps -
trying use docker setup bunch of apps behind proxy using nginx maps option ease of configuration large number of backend applications.
the trouble i'm running container won't resolve addresses i've given links.
i've tried using dnsmasq troublesome, , didn't give me working resolution.
any suggestions? nginx.conf:
events { worker_connections 1024; } http { map $hostname $destination { hostnames; default host1:81; host1.test.local host1:81; host2.test.local host2:82; host3.test.local host3:83; } server { location / { proxy_pass http://$destination/; } } }
docker-compose.yml:
webproxy: build: nginx:latest ports: - "80:80" volumes: - nginx.conf:/etc/nginx/nginx.conf links: - "host1:host1" - "host2:host2" - "host3:host3" host1: image: nginx:latest ports: - "81:80" volumes: - host1/index.html:/usr/share/nginx/html/index.html host2: image: nginx:latest ports: - "82:80" volumes: - host2/index.html:/usr/share/nginx/html/index.html host3: image: nginx:latest ports: - "83:80" volumes: - host3/index.html:/usr/share/nginx/html/index.html
error get:
webproxy_1 | 2015/07/14 16:44:11 [error] 5#0: *1 no resolver defined resolve host1, client: 10.0.2.2, server: , request: "get / http/1.1", host: "host2.test.local:8281" webproxy_1 | 10.0.2.2 - - [14/jul/2015:16:44:11 +0000] "get / http/1.1" 502 181 "-" "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:39.0) gecko/20100101 firefox/39.0"
Comments
Post a Comment