Advertisement
Guest User

HAProxy-config

a guest
Feb 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.51 KB | None | 0 0
  1. global
  2.     log /dev/log local0
  3.     log /dev/log local1 notice
  4.     chroot /var/lib/haproxy
  5.     maxconn 2048
  6.     stats timeout 30s
  7.     user haproxy
  8.     group haproxy
  9.     daemon
  10.  
  11. defaults
  12.     log global
  13.     mode http
  14.     option httplog
  15.     option dontlognull
  16.     option forwardfor
  17.     option http-server-close
  18.     timeout connect 5000
  19.     timeout client 5000
  20.     timeout server 5000
  21.  
  22. listen stats
  23.     bind *:8181
  24.     stats enable
  25.     stats uri /
  26.     stats realm Haproxy\ Statistics
  27.     stats auth admin:9zmq893f
  28.  
  29. frontend homes
  30.     bind 10.20.1.15:80
  31.     mode http
  32.     timeout http-request 5s
  33.     option forwardfor
  34.     reqadd X-Forwarded-Proto:\ http
  35.     acl is_privetdrive          hdr_end(host) -i www.privetdrive.net
  36.     acl is_privetdrive          hdr_end(host) -i privetdrive.net
  37.     acl is_unifi                hdr_end(host) -i unifi.privetdrive.net
  38.     acl is_unms                 hdr_end(host) -i unms.privetdrive.net
  39.     acl is_quake                hdr_end(host) -i quake.privetdrive.net
  40.     acl is_sundsvallbbq         hdr_end(host) -i sundsvallbbq.se
  41.     acl is_sundsvallbbq         hdr_end(host) -i www.sundsvallbbq.se
  42.  
  43.     use_backend                 webserver if is_privetdrive
  44.     use_backend                 webserver if is_sundsvallbbq
  45.     use_backend                 unifi if is_unifi
  46.     use_backend                 unms if is_unms
  47.     use_backend                 quake if is_quake
  48.    
  49.     redirect scheme https if { hdr(Host) -i www.privetdrive.net } !{ ssl_fc }
  50.     redirect scheme https if { hdr(Host) -i privetdrive.net } !{ ssl_fc }
  51.     redirect scheme https if { hdr(Host) -i www.sundsvallbbq.se } !{ ssl_fc }
  52.     redirect scheme https if { hdr(Host) -i sundsvallbbq.se } !{ ssl_fc }
  53.  
  54. stats uri /haproxy?stats
  55.     acl letsencrypt-acl path_beg /.well-known/acme-challenge/
  56.     use_backend letsencrypt-backend if letsencrypt-acl
  57.     default_backend http_backend
  58.  
  59. frontend https_homes
  60.     bind *:443 ssl crt-list /etc/ssl/crt-list.txt alpn h2,http/1.1
  61.     reqadd X-Forwarded-Proto:\ https
  62.     acl is_privetdrive  hdr_end(host) -i privetdrive.net
  63.     acl is_privetdrive  hdr_end(host) -i www.privetdrive.net
  64.     acl is_privetdrive  hdr_end(host) -i sundsvallbbq.se
  65.     acl is_privetdrive  hdr_end(host) -i www.sundsvallbbq.se
  66.     use_backend     unifi if is_unifi
  67.     use_backend     unms if is_unms
  68.     use_backend     quake if is_quake
  69.     default_backend homes_backend
  70.  
  71. backend homes_backend
  72.     http-response set-header Strict-Transport-Security "max-age=15778463; includeSubDomains; preload;"
  73.     server webserver 10.20.1.85:80 check
  74.  
  75. backend unifi
  76.     server unifi 10.20.1.11:8443 check
  77.  
  78. backend unms
  79.     server unms 10.20.1.12:80 check
  80.  
  81. backend quake
  82.     server quake 10.20.1.5 check
  83.  
  84. backend letsencrypt-backend
  85.     server letsencrypt 127.0.0.1:8888
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement