[root@s1 haproxy-2.0.6]# more conf/haproxy.cfg
#
# This is a sample configuration. It illustrates how to separate static objects
# traffic from dynamic traffic, and how to dynamically regulate the server load.
#
# It listens on 192.168.1.10:80, and directs all requests for Host 'img' or
# URIs starting with /img or /css to a dedicated group of servers. URIs
# starting with /admin/stats deliver the stats page.
#
global
maxconn 10000
stats socket /var/run/haproxy.stat mode 600 level admin
log 127.0.0.1 local0
user root
group root
chroot /var/empty
daemon
# The public 'www' address in the DMZ
frontend public
bind 0.0.0.0:80 name clear
#bind 192.168.1.10:443 ssl crt /etc/haproxy/haproxy.pem
mode http
log global
option httplog
option dontlognull
monitor-uri /monitoruri
maxconn 8000
timeout client 30s
stats uri /admin/stats
use_backend static if { path_end .html .jpg }
default_backend dynamic
# The static backend backend for 'Host: img', /img and /css.
backend static
mode http
balance roundrobin
option prefer-last-server
retries 2
option redispatch
timeout connect 5s
timeout server 5s
option httpchk GET /index.html
server statsrv1 192.168.1.226:80 check inter 1000
server statsrv2 192.168.1.227:80 check inter 1000
# the application servers go here
backend dynamic
mode http
balance roundrobin
retries 2
option redispatch
timeout connect 5s
timeout server 30s
timeout queue 30s
option httpchk GET /index.html
cookie DYNSRV insert indirect nocache
fullconn 4000 # the servers will be used at full load above this number of connections
server dynsrv1 192.168.1.228:80 minconn 50 maxconn 500 cookie s1 check inter 1000
server dynsrv2 192.168.1.229:80 minconn 50 maxconn 500 cookie s2 check inter 1000
server dynsrv3 192.168.1.230:80 minconn 50 maxconn 500 cookie s3 check inter 1000
遇到难题? "AI大模型GPT4.0、GPT" 是你的私人解答专家! 点击按钮去提问......