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