Skip to content

Instantly share code, notes, and snippets.

@churrops
Created August 25, 2017 20:44
Show Gist options
  • Save churrops/c820982429e42d56c271509b5e8079d6 to your computer and use it in GitHub Desktop.
Save churrops/c820982429e42d56c271509b5e8079d6 to your computer and use it in GitHub Desktop.
global
log 127.0.0.1 local0 notice
maxconn 6000
user haproxy
group haproxy
daemon
stats socket /tmp/haproxy.sock
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
#testa opcao de keepalive pra cliente e no-keepalive pros backends
option http-server-close
option httpclose
retries 3
option redispatch
maxconn 6000 # Numero maximo de conexoes simultaneas
timeout http-request 300000
timeout connect 50000
timeout client 50000
timeout server 300000 # Quanto tempo esperar por uma resposta do backend antes de dar timeout
timeout queue 10000 # 10 Segundos de fila caso backends estejam lotados
listen Frontend 0.0.0.0:80
mode http
option forwardfor except 127.0.0.127 # Adiciona X-Forwarded-For pra tudo menos conexoes de localhost
maxconn 3000
balance roundrobin
#bloqueia requests com encoding quebrado
reqideny amp\;editionId
# APP1
acl apache_rdglinux_com hdr_dom(host) -i apache.rdglinux.com
use_backend app1 if apache_rdglinux_com
# APP2
acl nginx_rdglinux_com hdr_dom(host) -i nginx.rdglinux.com
use_backend app2 if nginx_rdglinux_com
## Backend's
backend app1
mode http close
timeout http-request 300000
cookie JSESSIONID indirect preserve
appsession JSESSIONID len 7 timeout 3h prefix
server apache01 localhost:9090 cookie JSESSIONID maxconn 75 check port 9090 inter 2000 rise 4 fall 2
backend app2
mode http close
timeout http-request 300000
cookie JSESSIONID indirect preserve
appsession JSESSIONID len 7 timeout 3h prefix
server nginx1 localhost:7070 cookie JSESSIONID maxconn 75 check port 7070 inter 2000 rise 4 fall 2
## Stats
#
listen Stats 0.0.0.0:7583
mode http
stats enable
stats auth admin:admin
stats uri /stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment