haproxy.cfg (2609B)
1 # Example configuration file for HAProxy 1.3, refer to the url below for 2 # a full documentation and examples for configuration: 3 # http://haproxy.1wt.eu/download/1.3/doc/configuration.txt 4 5 6 # Global parameters 7 global 8 9 # Log events to a remote syslog server at given address using the 10 # specified facility and verbosity level. Multiple log options 11 # are allowed. 12 #log 10.0.0.1 daemon info 13 14 # Specifiy the maximum number of allowed connections. 15 maxconn 32000 16 17 # Raise the ulimit for the maximum allowed number of open socket 18 # descriptors per process. This is usually at least twice the 19 # number of allowed connections (maxconn * 2 + nb_servers + 1) . 20 ulimit-n 65535 21 22 # Drop privileges (setuid, setgid), default is "root" on OpenWrt. 23 uid 0 24 gid 0 25 26 # Perform chroot into the specified directory. 27 #chroot /var/run/haproxy/ 28 29 # Daemonize on startup 30 daemon 31 32 nosplice 33 # Enable debugging 34 #debug 35 36 # Spawn given number of processes and distribute load among them, 37 # used for multi-core environments or to circumvent per-process 38 # limits like number of open file descriptors. Default is 1. 39 #nbproc 2 40 41 42 # Example HTTP proxy listener 43 listen my_http_proxy 44 45 # Bind to port 81 and 444 on all interfaces (0.0.0.0) 46 bind :81,:444 47 48 # We're proxying HTTP here... 49 mode http 50 51 # Simple HTTP round robin over two servers using the specified 52 # source ip 192.168.1.1 . 53 balance roundrobin 54 server server01 192.168.1.10:80 source 192.168.1.1 55 server server02 192.168.1.20:80 source 192.168.1.1 56 57 # Serve an internal statistics page on /stats: 58 stats enable 59 stats uri /stats 60 61 # Enable HTTP basic auth for the statistics: 62 stats realm HA_Stats 63 stats auth username:password 64 65 66 # Example SMTP proxy listener 67 listen my_smtp_proxy 68 69 # Disable this instance without commenting out the section. 70 disabled 71 72 # Bind to port 26 and 588 on localhost 73 bind 127.0.0.1:26,127.0.0.1:588 74 75 # This is a TCP proxy 76 mode tcp 77 78 # Round robin load balancing over two servers on port 123 forcing 79 # the address 192.168.1.1 and port 25 as source. 80 balance roundrobin 81 #use next line for transparent proxy, so the servers can see the 82 #original ip-address and remove source keyword in server definition 83 #source 0.0.0.0 usesrc clientip 84 server server01 192.168.1.10:123 source 192.168.1.1:25 85 server server02 192.168.1.20:123 source 192.168.1.1:25 86 87 88 # Special health check listener for integration with external load 89 # balancers. 90 listen local_health_check 91 92 # Listen on port 60000 93 bind :60000 94 95 # This is a health check 96 mode health 97 98 # Enable HTTP-style responses: "HTTP/1.0 200 OK" 99 # else just print "OK". 100 #option httpchk