Skip to content

Instantly share code, notes, and snippets.

@lifez
Created June 13, 2017 09:34
Show Gist options
  • Save lifez/d81253bdf20b171e4828b6f9ff149af4 to your computer and use it in GitHub Desktop.
Save lifez/d81253bdf20b171e4828b6f9ff149af4 to your computer and use it in GitHub Desktop.
{{ range $host, $containers := groupBy $ "Env.VIRTUAL_HOST" }}
upstream {{ $host }} {
{{ range $index, $value := $containers }}
{{ $network := index $value.Networks 0 }}
{{ with $address := index $value.Addresses 0 }}
server {{ $network.IP }}:80;
server {{ $network.IP }}:443;
{{ 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 / {
proxy_pass http://{{ $host }};
}
}
{{ end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment