CLEANUP: examples: fix the example file content-sw-sample.cfg
This one didn't load anymore, but it was worth updating it since it matches most common needs.
This commit is contained in:
parent
ae4865d802
commit
677457e882
|
@ -1,75 +1,65 @@
|
||||||
#
|
#
|
||||||
# This is a sample configuration
|
# This is a sample configuration. It illustrates how to separate static objects
|
||||||
# haproxy >= 1.3.4 required.
|
# 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
|
# 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
|
# URIs starting with /img or /css to a dedicated group of servers. URIs
|
||||||
# starting with /admin/stats are directed to a backend dedicated to statistics.
|
# starting with /admin/stats deliver the stats page.
|
||||||
#
|
#
|
||||||
|
|
||||||
global
|
global
|
||||||
maxconn 10000
|
maxconn 10000
|
||||||
|
stats socket /var/run/haproxy.stat mode 600 level admin
|
||||||
log 127.0.0.1 local0
|
log 127.0.0.1 local0
|
||||||
uid 200
|
uid 200
|
||||||
gid 200
|
gid 200
|
||||||
chroot /var/empty
|
chroot /var/empty
|
||||||
daemon
|
daemon
|
||||||
|
|
||||||
|
|
||||||
# The public 'www' address in the DMZ
|
# The public 'www' address in the DMZ
|
||||||
frontend public
|
frontend public
|
||||||
bind 192.168.1.10:80
|
bind 192.168.1.10:80 name clear
|
||||||
|
#bind 192.168.1.10:443 ssl crt /etc/haproxy/haproxy.pem
|
||||||
mode http
|
mode http
|
||||||
log global
|
log global
|
||||||
option httplog
|
option httplog
|
||||||
option dontlognull
|
option dontlognull
|
||||||
option httpclose
|
monitor-uri /monitoruri
|
||||||
monitor-uri /monitoruri
|
maxconn 8000
|
||||||
maxconn 8000
|
timeout client 30s
|
||||||
clitimeout 30000
|
|
||||||
|
|
||||||
# Host: will use a specific keyword soon
|
|
||||||
reqisetbe ^Host:\ img static
|
|
||||||
|
|
||||||
# The URI will use a specific keyword soon
|
|
||||||
reqisetbe ^[^\ ]*\ /(img|css)/ static
|
|
||||||
reqisetbe ^[^\ ]*\ /admin/stats stats
|
|
||||||
|
|
||||||
default_backend dynamic
|
|
||||||
|
|
||||||
|
stats uri /admin/stats
|
||||||
|
use_backend static if { hdr_beg(host) -i img }
|
||||||
|
use_backend static if { path_beg /img /css }
|
||||||
|
default_backend dynamic
|
||||||
|
|
||||||
# The static backend backend for 'Host: img', /img and /css.
|
# The static backend backend for 'Host: img', /img and /css.
|
||||||
backend static
|
backend static
|
||||||
mode http
|
|
||||||
balance roundrobin
|
|
||||||
contimeout 5000
|
|
||||||
srvtimeout 5000
|
|
||||||
redispatch
|
|
||||||
retries 2
|
|
||||||
option httpchk HEAD /favicon.ico
|
|
||||||
server statsrv1 192.168.1.8:80 check inter 1000
|
|
||||||
server statsrv2 192.168.1.9:80 check inter 1000
|
|
||||||
|
|
||||||
|
|
||||||
backend dynamic
|
|
||||||
mode http
|
|
||||||
balance roundrobin
|
|
||||||
contimeout 30000
|
|
||||||
srvtimeout 30000
|
|
||||||
redispatch
|
|
||||||
retries 2
|
|
||||||
option httpchk HEAD /login.php
|
|
||||||
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.1:80 minconn 50 maxconn 500 cookie s1 check inter 1000
|
|
||||||
server dynsrv2 192.168.1.2:80 minconn 50 maxconn 500 cookie s2 check inter 1000
|
|
||||||
server dynsrv3 192.168.1.3:80 minconn 50 maxconn 500 cookie s3 check inter 1000
|
|
||||||
server dynsrv4 192.168.1.4:80 minconn 50 maxconn 500 cookie s4 check inter 1000
|
|
||||||
|
|
||||||
|
|
||||||
backend stats
|
|
||||||
log global
|
|
||||||
mode http
|
mode http
|
||||||
stats uri /
|
|
||||||
balance roundrobin
|
balance roundrobin
|
||||||
|
option prefer-last-server
|
||||||
|
retries 2
|
||||||
|
option redispatch
|
||||||
|
timeout connect 5s
|
||||||
|
timeout server 5s
|
||||||
|
option httpchk HEAD /favicon.ico
|
||||||
|
server statsrv1 192.168.1.8:80 check inter 1000
|
||||||
|
server statsrv2 192.168.1.9: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 HEAD /login.php
|
||||||
|
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.1:80 minconn 50 maxconn 500 cookie s1 check inter 1000
|
||||||
|
server dynsrv2 192.168.1.2:80 minconn 50 maxconn 500 cookie s2 check inter 1000
|
||||||
|
server dynsrv3 192.168.1.3:80 minconn 50 maxconn 500 cookie s3 check inter 1000
|
||||||
|
server dynsrv4 192.168.1.4:80 minconn 50 maxconn 500 cookie s4 check inter 1000
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue