blob: 84d55a3071fd80be14cbc2b3a4607dd511c9467f [file] [log] [blame]
Willy Tarreau6d1a9882007-01-07 02:03:04 +01001#
2# This is a sample configuration
3# haproxy >= 1.3.5 required.
4#
5# It listens on 192.168.1.10:80, and directs all requests for Host 'img' or
6# URIs starting with /img or /css to a dedicated group of servers. URIs
7# starting with /admin/stats are directed to a backend dedicated to statistics.
8# TCP splicing is used on static objects to relieve the process from the heavy
9# job.
10#
11
12global
13 maxconn 10000
14 log 127.0.0.1 local0
15 uid 200
16 gid 200
17 chroot /var/empty
18 daemon
19
20
21# The public 'www' address in the DMZ
22frontend public
23 bind 192.168.1.10:80
24 mode http
25 log global
26 option httplog
27 option dontlognull
28 option httpclose
29 option tcpsplice
30 monitor-uri /monitoruri
31 maxconn 8000
32 clitimeout 30000
33
34 # Host: will use a specific keyword soon
35 reqisetbe ^Host:\ img static
36
37 # The URI will use a specific keyword soon
38 reqisetbe ^[^\ ]*\ /(img|css)/ static
39 reqisetbe ^[^\ ]*\ /admin/stats stats
40
41 default_backend dynamic
42
43
44# The static backend backend for 'Host: img', /img and /css.
45# TCP splicing is enabled on this backend because we don't expect to do
46# anything interesting with static objects, but we know they can eat much
47# bandwidth.
48backend static
49 mode http
50 balance roundrobin
51 option tcpsplice
52 contimeout 5000
53 srvtimeout 5000
54 redispatch
55 retries 2
56 option httpchk HEAD /favicon.ico
57 server statsrv1 192.168.1.8:80 check inter 1000
58 server statsrv2 192.168.1.9:80 check inter 1000
59
60
61backend dynamic
62 mode http
63 balance roundrobin
64 contimeout 30000
65 srvtimeout 30000
66 redispatch
67 retries 2
68 option httpchk HEAD /login.php
69 cookie DYNSRV insert indirect nocache
70 fullconn 4000 # the servers will be used at full load above this number of connections
71 server dynsrv1 192.168.1.1:80 minconn 50 maxconn 500 cookie s1 check inter 1000
72 server dynsrv2 192.168.1.2:80 minconn 50 maxconn 500 cookie s2 check inter 1000
73 server dynsrv3 192.168.1.3:80 minconn 50 maxconn 500 cookie s3 check inter 1000
74 server dynsrv4 192.168.1.4:80 minconn 50 maxconn 500 cookie s4 check inter 1000
75
76
77backend stats
78 log global
79 mode http
80 stats uri /
81 balance roundrobin
82