Skip to content

Instantly share code, notes, and snippets.

@jschwindt
Created October 9, 2013 14:54
Show Gist options
  • Save jschwindt/6902596 to your computer and use it in GitHub Desktop.
Save jschwindt/6902596 to your computer and use it in GitHub Desktop.
HAProxy with SSL/TLS support
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
user haproxy
group haproxy
daemon
stats socket /var/run/haproxy.sock
defaults
log global
mode http
option httplog
option forwardfor
option dontlognull
option httpclose
option redispatch
# VERY IMPORTANT OPTION: Analyze each request individually and evaluate acls for each request. Don't run in tunnel mode.
option http-server-close
retries 2
maxconn 40000
contimeout 10000
clitimeout 300000
srvtimeout 300000
stats uri /ha_stats
stats realm Global\ statistics
stats auth haproxy:yourpass
frontend web
bind 0.0.0.0:80
bind 0.0.0.0:443 ssl crt /etc/haproxy/certs/ssl.full.crt
acl acl_fbfeed path_beg -i /publicfeed/
acl acl_static path_beg -i /assets/
acl acl_static path_beg -i /media/
acl acl_static path_end -i .gif .png .jpg .css .js .ico .html .htm .swf
use_backend farm_static if acl_static
use_backend farm_fbfeed if acl_fbfeed
default_backend farm_app
backend farm_app
balance roundrobin
option httpchk GET / HTTP/1.1\r\nHost:\ example.com
server srv-frontend1 ctvbe01:80 maxconn 12
server srv-frontend2 ctvbe02:80 maxconn 12
backend farm_fbfeed
balance roundrobin
server srv-fbfeed 127.0.0.1:4567 maxconn 50 check
backend farm_static
balance roundrobin
server srv-static0 ctvbe01:80 maxconn 250 check
server srv-static1 ctvbe02:80 maxconn 250 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment