haproxy.cfg 2.5 KB

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