Last active
October 4, 2019 03:49
-
-
Save johnsusek/6a87042ce7b2f68037db0885df7627b0 to your computer and use it in GitHub Desktop.
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
# /etc/haproxy/haproxy.cfg, version 1.4 | |
global | |
maxconn 4096 | |
user haproxy | |
group haproxy | |
daemon | |
defaults | |
log global | |
mode http | |
# logs which servers requests go to, plus current connections and a whole lot of other stuff | |
option httplog | |
option dontlognull | |
retries 3 | |
option redispatch | |
maxconn 2000 | |
contimeout 5000 | |
clitimeout 50000 | |
srvtimeout 50000 | |
log 127.0.0.1 local0 | |
# use rsyslog rules to forword to a centralized server | |
log 127.0.0.1 local7 debug | |
# check webservers for health, taking them out of the queue as necessary | |
option httpchk | |
# this load balancer servers both www.site.com and static.site.com, but those two URLS have | |
# different servers on the backend (app servers versus statis media apache instances) | |
# also, I want to server www.site.com/static/* from the later farm | |
frontend http | |
bind 0.0.0.0:80 | |
# important, see comment from Willy Tarreau bellow | |
option http-server-close | |
# NAT static host names and static paths in other hostnames to static.bullhornreach.com | |
acl host_static hdr_beg(host) -i static | |
acl url_static path_beg /static | |
use_backend static if host_static | |
use_backend static if url_static | |
default_backend www | |
backend www | |
balance roundrobin | |
server www1 www1 check port 80 | |
server www2 www2 check port 80 | |
server www3 www3 check port 80 | |
# provide a maintenance page functionality, only used when all other servers are down | |
server load1 localhost:8080 backup | |
backend static | |
# for static media, connections are cheap, plus the client is very likely to request multiple files | |
# so, keep the connection open (KeepAlive is the default) | |
balance roundrobin | |
server media1 media1 media1 check port 80 | |
server media2 media2 media2 check port 80 | |
listen stats | |
bind :1936 | |
mode http | |
stats enable | |
stats scope http | |
stats scope www | |
stats scope static | |
stats scope static_httpclose | |
stats realm Haproxy\ Statistics | |
stats uri / | |
stats auth haproxy:YOURPASSWORDHERE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment