Skip to content

Instantly share code, notes, and snippets.

@stv-io
Created February 12, 2015 15:39
Show Gist options
  • Select an option

  • Save stv-io/a91baa803c223406e278 to your computer and use it in GitHub Desktop.

Select an option

Save stv-io/a91baa803c223406e278 to your computer and use it in GitHub Desktop.
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend main *:5000
acl url_static path_beg -i /static /images /javascript /stylesheets
acl url_static path_end -i .jpg .gif .png .css .js
use_backend static if url_static
default_backend app
frontend work_casumo_com_http
mode http
bind 10.164.19.123:80
acl is_work.casumo.cum_url hdr_beg(host) -i work.casumo.com
redirect code 301 location http://www.casumocareers.com if is_work.casumo.cum_url
#---------------------------------------------------------------------
# static backend for serving up images, stylesheets and such
#---------------------------------------------------------------------
backend static
balance roundrobin
server static 127.0.0.1:4331 check
#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend app
balance roundrobin
server app1 127.0.0.1:5001 check
server app2 127.0.0.1:5002 check
server app3 127.0.0.1:5003 check
server app4 127.0.0.1:5004 check
##################################################
# admin page
listen admin-in
bind 10.164.19.123:888
stats enable
stats uri /admin?stats
stats realm Haproxy\ Statistics
stats auth admin:casum0br0ttar3
stats admin if TRUE
# only allow internal
acl network_allowed_admin src 192.168.50.0/24
acl haproxy_admin_restricted_page path_beg /admin?stats
http-request deny if haproxy_admin_restricted_page !network_allowed_admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment