haproxy.cfg 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #---------------------------------------------------------------------
  2. # Example configuration for a possible web application. See the
  3. # full configuration options online.
  4. #
  5. # https://www.haproxy.org/download/1.8/doc/configuration.txt
  6. #
  7. #---------------------------------------------------------------------
  8. #---------------------------------------------------------------------
  9. # Global settings
  10. #---------------------------------------------------------------------
  11. global
  12. # to have these messages end up in /var/log/haproxy.log you will
  13. # need to:
  14. #
  15. # 1) configure syslog to accept network log events. This is done
  16. # by adding the '-r' option to the SYSLOGD_OPTIONS in
  17. # /etc/sysconfig/syslog
  18. #
  19. # 2) configure local2 events to go to the /var/log/haproxy.log
  20. # file. A line like the following can be added to
  21. # /etc/sysconfig/syslog
  22. #
  23. # local2.* /var/log/haproxy.log
  24. #
  25. log 127.0.0.1 local2
  26. chroot /var/lib/haproxy
  27. pidfile /var/run/haproxy.pid
  28. maxconn 4000
  29. user haproxy
  30. group haproxy
  31. daemon
  32. # turn on stats unix socket
  33. stats socket /var/lib/haproxy/stats
  34. # utilize system-wide crypto-policies
  35. ssl-default-bind-ciphers PROFILE=SYSTEM
  36. ssl-default-server-ciphers PROFILE=SYSTEM
  37. #---------------------------------------------------------------------
  38. # common defaults that all the 'listen' and 'backend' sections will
  39. # use if not designated in their block
  40. #---------------------------------------------------------------------
  41. defaults
  42. mode http
  43. log global
  44. option httplog
  45. option dontlognull
  46. option http-server-close
  47. option forwardfor except 127.0.0.0/8
  48. option redispatch
  49. retries 3
  50. timeout http-request 10s
  51. timeout queue 1m
  52. timeout connect 10s
  53. timeout client 1m
  54. timeout server 1m
  55. timeout http-keep-alive 10s
  56. timeout check 10s
  57. maxconn 3000
  58. #---------------------------------------------------------------------
  59. # main frontend which proxys to the backends
  60. #---------------------------------------------------------------------
  61. frontend main
  62. bind *:5000
  63. acl url_static path_beg -i /static /images /javascript /stylesheets
  64. acl url_static path_end -i .jpg .gif .png .css .js
  65. use_backend static if url_static
  66. default_backend app
  67. #---------------------------------------------------------------------
  68. # static backend for serving up images, stylesheets and such
  69. #---------------------------------------------------------------------
  70. backend static
  71. balance roundrobin
  72. server static 127.0.0.1:4331 check
  73. #---------------------------------------------------------------------
  74. # round robin balancing between the various backends
  75. #---------------------------------------------------------------------
  76. backend app
  77. balance roundrobin
  78. server app1 127.0.0.1:5001 check
  79. server app2 127.0.0.1:5002 check
  80. server app3 127.0.0.1:5003 check
  81. server app4 127.0.0.1:5004 check