3924ac2
#---------------------------------------------------------------------
3924ac2
# Example configuration for a possible web application.  See the
3924ac2
# full configuration options online.
3924ac2
#
d641a47
#   http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
3924ac2
#
3924ac2
#---------------------------------------------------------------------
d55870e
3924ac2
#---------------------------------------------------------------------
3924ac2
# Global settings
3924ac2
#---------------------------------------------------------------------
d55870e
global
d36291d
    # to have these messages end up in /var/log/haproxy.log you will
d36291d
    # need to:
a415cbb
    #
d36291d
    # 1) configure syslog to accept network log events.  This is done
a415cbb
    #    by adding the '-r' option to the SYSLOGD_OPTIONS in
d36291d
    #    /etc/sysconfig/syslog
a415cbb
    #
d36291d
    # 2) configure local2 events to go to the /var/log/haproxy.log
a415cbb
    #   file. A line like the following can be added to
d36291d
    #   /etc/sysconfig/syslog
a415cbb
    #
d36291d
    #    local2.*                       /var/log/haproxy.log
a415cbb
    #
a415cbb
    log         127.0.0.1 local2
d36291d
3924ac2
    chroot      /var/lib/haproxy
3924ac2
    pidfile     /var/run/haproxy.pid
3924ac2
    maxconn     4000
3924ac2
    user        haproxy
3924ac2
    group       haproxy
3924ac2
    daemon
d55870e
d36291d
    # turn on stats unix socket
d36291d
    stats socket /var/lib/haproxy/stats
d36291d
3924ac2
#---------------------------------------------------------------------
a415cbb
# common defaults that all the 'listen' and 'backend' sections will
3924ac2
# use if not designated in their block
3924ac2
#---------------------------------------------------------------------
d55870e
defaults
f37db97
    mode                    http
f37db97
    log                     global
f37db97
    option                  httplog
f37db97
    option                  dontlognull
f37db97
    option http-server-close
d641a47
    option forwardfor       except 127.0.0.0/8
f37db97
    option                  redispatch
f37db97
    retries                 3
f37db97
    timeout http-request    10s
f37db97
    timeout queue           1m
f37db97
    timeout connect         10s
f37db97
    timeout client          1m
f37db97
    timeout server          1m
f37db97
    timeout http-keep-alive 10s
f37db97
    timeout check           10s
f37db97
    maxconn                 3000
d55870e
3924ac2
#---------------------------------------------------------------------
3924ac2
# main frontend which proxys to the backends
3924ac2
#---------------------------------------------------------------------
3924ac2
frontend  main *:5000
3924ac2
    acl url_static       path_beg       -i /static /images /javascript /stylesheets
3924ac2
    acl url_static       path_end       -i .jpg .gif .png .css .js
a415cbb
3924ac2
    use_backend static          if url_static
3924ac2
    default_backend             app
a415cbb
3924ac2
#---------------------------------------------------------------------
3924ac2
# static backend for serving up images, stylesheets and such
3924ac2
#---------------------------------------------------------------------
3924ac2
backend static
3924ac2
    balance     roundrobin
3924ac2
    server      static 127.0.0.1:4331 check
d55870e
3924ac2
#---------------------------------------------------------------------
3924ac2
# round robin balancing between the various backends
3924ac2
#---------------------------------------------------------------------
3924ac2
backend app
3924ac2
    balance     roundrobin
3924ac2
    server  app1 127.0.0.1:5001 check
3924ac2
    server  app2 127.0.0.1:5002 check
a415cbb
    server  app3 127.0.0.1:5003 check
3924ac2
    server  app4 127.0.0.1:5004 check
d55870e