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