Created
June 24, 2015 06:51
-
-
Save lgazo/460a739e640be720f626 to your computer and use it in GitHub Desktop.
consul template nginx shop
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
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