Skip to content

Instantly share code, notes, and snippets.

@aric49
Created March 1, 2019 18:49
Show Gist options
  • Select an option

  • Save aric49/bd051097e41e477c362410e5b3413023 to your computer and use it in GitHub Desktop.

Select an option

Save aric49/bd051097e41e477c362410e5b3413023 to your computer and use it in GitHub Desktop.
NGINX Reverse Proxy Load Balancer
#Unabashedly stolen and modified from: https://rancher.com/docs/rancher/v2.x/en/installation/ha/create-nodes-lb/nginx/
worker_processes auto;
worker_rlimit_nofile 40000;
events {
worker_connections 8192;
}
#Stream segment at root level of config!
stream {
upstream servers_http {
least_conn;
server <IP_NODE_1>:80 max_fails=3 fail_timeout=5s;
server <IP_NODE_2>:80 max_fails=3 fail_timeout=5s;
server <IP_NODE_3>:80 max_fails=3 fail_timeout=5s;
}
server {
listen 80;
proxy_pass servers_http;
}
upstream servers_https {
least_conn;
server <IP_NODE_1>:443 max_fails=3 fail_timeout=5s;
server <IP_NODE_2>:443 max_fails=3 fail_timeout=5s;
server <IP_NODE_3>:443 max_fails=3 fail_timeout=5s;
}
server {
listen 443;
proxy_pass servers_https;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment