Last active
August 1, 2019 23:27
-
-
Save bentesha/2406693851d8e54606fdad3e5b283f2b to your computer and use it in GitHub Desktop.
Min HAProxy Config with ACL for Load Balancing Multiple Name Virtual Hosts
This file contains 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
global | |
maxconn 25000 | |
log /dev/log local0 info | |
# debug | |
# silent | |
user haproxy | |
group haproxy | |
daemon | |
defaults | |
mode http | |
# in tcp mode, client and server timeouts should be set to the save value | |
timeout connect 10s | |
timeout client 10s | |
timeout server 10s | |
log global # use log settings defined in the global section | |
maxconn 25000 | |
option httplog # generates more verbose log output | |
option dontlognull # don't log sessions for which there was not exchange of data | |
retries 3 | |
option redispatch # retry request with other servers on failure | |
option abortonclose # abort request if client close connection | |
frontend http | |
bind 192.168.10.12:80 | |
bind 182.168.10.12:443 ssl crt /etc/ssl/mycert.pem | |
acl is_domain1 hdr_dom(host) -i domain1.my-site.com | |
use_backend be_domain1 if is_domain1 | |
default_backend be_default | |
backend be_domain1 | |
balance roundrobin # or use leastcon to pick server with least number of connections | |
option httpchk HEAD /health # use HEAD /health to check for server health status | |
default-server maxconn 20 check | |
server server1 127.0.0.1:8080 | |
server server2 127.0.0.1:8081 | |
backend be_default | |
balance roundrobin | |
option httphchk HEAD /health | |
default-server maxconn 20 check | |
server server1 127.0.0.1:9090 | |
serrver server2 127.0.0.1:9091 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment