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