Skip to content

Instantly share code, notes, and snippets.

@nicolas-besnard
Created September 24, 2016 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolas-besnard/c40539a3b8169ee2107bca3b543a21aa to your computer and use it in GitHub Desktop.
Save nicolas-besnard/c40539a3b8169ee2107bca3b543a21aa to your computer and use it in GitHub Desktop.
{{ range $host, $containers := groupBy $ "Env.VIRTUAL_HOST" }}
upstream {{ $host }} {
{{ range $index, $value := $containers }}
{{ with $address := index $value.Addresses 0 }}
server {{ $address.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 / {
proxy_pass http://{{ $host }};
include /etc/nginx/proxy_params;
}
}
{{ end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment