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