Skip to content

Instantly share code, notes, and snippets.

@mavencode01
Forked from lgazo/gist:460a739e640be720f626
Created February 12, 2016 18:02
Show Gist options
  • Save mavencode01/1bff1697512768aa3373 to your computer and use it in GitHub Desktop.
Save mavencode01/1bff1697512768aa3373 to your computer and use it in GitHub Desktop.
consul template nginx shop
upstream shop {
least_conn;
{{range service "shop"}}server {{.Address}}:{{.Port}} max_fails=3 fail_timeout=60 weight=1;
{{else}}server 127.0.0.1:65535; # force a 502{{end}}
}
server {
listen 80;
server_name api.shop.com;
location / {
proxy_pass http://shop;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment