Created
August 6, 2018 23:26
-
-
Save karimamer/ce04b98910c02ca2aee7dbf156076f36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ range $host, $containers := groupBy $ "Env.VIRTUAL_HOST" }} | |
upstream {{ $host }} { | |
{{ range $index, $value := $containers }} | |
{{ with $address := index $value.Addresses 0 }} | |
server {{ .Network.IP }}:{{.Address.Port}}; | |
{{ end }} | |
{{ end }} | |
} | |
server { | |
#ssl_certificate /etc/nginx/certs/demo.pem; | |
#ssl_certificate_key /etc/nginx/certs/demo.key; | |
gzip_types text/plain text/css application/json application/x-javascript | |
text/xml application/xml application/xml+rss text/javascript; | |
server_name {{ $host }}; | |
location /{{.Container.Name }}/ { | |
rewrite ^/{{.Container.Name }}.*) /$1 break; | |
proxy_pass {{ .Network.IP }}:{{.Address.Port}}; | |
} | |
} | |
{{ end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment