Skip to content

Instantly share code, notes, and snippets.

@PreSoichiSumi
Last active April 11, 2016 07:24
Show Gist options
  • Save PreSoichiSumi/a232ec935f61ed58ae3214f9b4c830d0 to your computer and use it in GitHub Desktop.
Save PreSoichiSumi/a232ec935f61ed58ae3214f9b4c830d0 to your computer and use it in GitHub Desktop.
nginx load-balancing
http {
upstream myapp1 {
server srv1.example.com;
server srv2.example.com;
server srv3.example.com;
}
server {
listen 80;
location / {
proxy_pass http://myapp1;
}
}
}
#least_conn
upstream myapp1 {
least_conn;
server srv1.example.com;
server srv2.example.com;
server srv3.example.com;
}
#ip_hash
upstream myapp1 {
ip_hash;
server srv1.example.com;
server srv2.example.com;
server srv3.example.com;
}
#weighted load-balancing
upstream myapp1 {
server srv1.example.com weight=3;
server srv2.example.com;
server srv3.example.com;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment