ngompa / rpms / haproxy

Forked from rpms/haproxy 4 years ago
Clone

Blame SOURCES/haproxy.cfg

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