Created
May 29, 2020 12:39
-
-
Save lrascao/c55f7f41c36bc805f1c55c5edd15da06 to your computer and use it in GitHub Desktop.
nginx based load balancer
This file contains hidden or 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
# mkdir -p /tmp/nginx | |
# nginx -c `pwd`/nginx-local-lb.conf | |
daemon off; | |
error_log /tmp/nginx/error.log warn; | |
# Define which servers to include in the load balancing scheme. | |
stream { | |
upstream stream_backend { | |
# server1 tcp port | |
server 127.0.0.1:7003; | |
# server2 tcp port | |
server 127.0.0.1:6003; | |
} | |
log_format compression '$remote_addr:$remote_port - [$time_local] - $status'; | |
server { | |
# listen on the 9001 ssl default | |
listen 9001 ssl; | |
proxy_pass stream_backend; | |
ssl_certificate letsencrypt/fullchain1.pem; | |
ssl_certificate_key letsencrypt/privkey1.pem; | |
access_log /tmp/nginx/access.log compression; | |
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
} | |
} | |
events { | |
worker_connections 4096; ## Default: 1024 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment