Willy Tarreau | 85270da | 2007-01-02 00:59:39 +0100 | [diff] [blame] | 1 | # |
| 2 | # This is a sample configuration |
| 3 | # haproxy >= 1.3.4 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 | # |
| 9 | |
| 10 | global |
| 11 | maxconn 10000 |
| 12 | log 127.0.0.1 local0 |
| 13 | uid 200 |
| 14 | gid 200 |
| 15 | chroot /var/empty |
| 16 | daemon |
| 17 | |
| 18 | |
| 19 | # The public 'www' address in the DMZ |
| 20 | frontend public |
| 21 | bind 192.168.1.10:80 |
| 22 | mode http |
| 23 | log global |
| 24 | option httplog |
| 25 | option dontlognull |
| 26 | option httpclose |
| 27 | monitor-uri /monitoruri |
| 28 | maxconn 8000 |
| 29 | clitimeout 30000 |
| 30 | |
| 31 | # Host: will use a specific keyword soon |
| 32 | reqisetbe ^Host:\ img static |
| 33 | |
| 34 | # The URI will use a specific keyword soon |
| 35 | reqisetbe ^[^\ ]*\ /(img|css)/ static |
| 36 | reqisetbe ^[^\ ]*\ /admin/stats stats |
| 37 | |
| 38 | default_backend dynamic |
| 39 | |
| 40 | |
| 41 | # The static backend backend for 'Host: img', /img and /css. |
| 42 | backend static |
| 43 | mode http |
| 44 | balance roundrobin |
| 45 | contimeout 5000 |
| 46 | srvtimeout 5000 |
| 47 | redispatch |
| 48 | retries 2 |
| 49 | option httpchk HEAD /favicon.ico |
| 50 | server statsrv1 192.168.1.8:80 check inter 1000 |
| 51 | server statsrv2 192.168.1.9:80 check inter 1000 |
| 52 | |
| 53 | |
| 54 | backend dynamic |
| 55 | mode http |
| 56 | balance roundrobin |
| 57 | contimeout 30000 |
| 58 | srvtimeout 30000 |
| 59 | redispatch |
| 60 | retries 2 |
| 61 | option httpchk HEAD /login.php |
| 62 | cookie DYNSRV insert indirect nocache |
| 63 | fullconn 4000 # the servers will be used at full load above this number of connections |
| 64 | server dynsrv1 192.168.1.1:80 minconn 50 maxconn 500 cookie s1 check inter 1000 |
| 65 | server dynsrv2 192.168.1.2:80 minconn 50 maxconn 500 cookie s2 check inter 1000 |
| 66 | server dynsrv3 192.168.1.3:80 minconn 50 maxconn 500 cookie s3 check inter 1000 |
| 67 | server dynsrv4 192.168.1.4:80 minconn 50 maxconn 500 cookie s4 check inter 1000 |
| 68 | |
| 69 | |
| 70 | backend stats |
| 71 | log global |
| 72 | mode http |
| 73 | stats uri / |
| 74 | balance roundrobin |
| 75 | |