Created
November 7, 2014 05:02
-
-
Save x684867/5800de73d84eceae2a1c to your computer and use it in GitHub Desktop.
Demonstrates proxy pass load balancing to alternative localhost ports.
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
#See documentation at http://nginx.com/resources/admin-guide/load-balancer/ | |
upstream loadbalancer { | |
#LHS:80 load balancer end point | |
server 127.0.0.1 max_fails=1 fail_timeout=5s; | |
#RHS:80 load balancer end point | |
server 127.0.0.2 max_fails=1 fail_timeout=5s; | |
} | |
server { | |
# | |
# This is the overall end point for all HTTP/S services | |
# This end point will load balance to the tcp/80 upstream | |
# servers end points which proxy-pass traffic to app. | |
# | |
listen 80; | |
listen 443 default ssl; | |
gzip on; | |
# gzip_comp_level 6; | |
# gzip_buffers 16 8k; | |
# gzip_http_version 1.1; | |
gzip_types text/plain application/json; | |
server_name endpoint.server.tld; | |
ssl_protocols TLSv1; | |
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+EXP; | |
ssl_prefer_server_ciphers on; | |
ssl_certificate /etc/ssl/mykey.pem; | |
ssl_certificate_key /etc/ssl/mykey.key; | |
access_log /var/log/nginx/localhost.access.log; | |
location / { | |
proxy_pass http://loadbalancer; | |
} | |
} | |
server { | |
listen 127.0.0.1:80; | |
server_name lhs; | |
location / { | |
proxy_pass http://127.0.0.1:8080; | |
} | |
} | |
server { | |
listen 127.0.0.2:80; | |
server_name rhs; | |
location /{ | |
proxy_pass http://127.0.0.2:8080; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment