ngompa / rpms / haproxy

Forked from rpms/haproxy 4 years ago
Clone

Blame SOURCES/haproxy.cfg

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