nginx.tmpl
Config balancer NGINXGeksogen
plain_text
3 years ago
497 B
9
Indexable
{{ range $host, $containers := groupBy $ "Env.VIRTUAL_HOST" }}
upstream {{ $host }} {
{{ range $index, $value := $containers }}
{{ with $address := index $value.Addresses 0 }}
server {{ $value.Hostname }}:{{ $address.Port }};
{{ end }}
{{ end }}
}
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://{{ $host }};
}
}
{{ end }}Editor is loading...