ngompa / rpms / haproxy

Forked from rpms/haproxy 4 years ago
Clone

Blame SOURCES/haproxy.cfg

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