haproxy.cfg 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. global
  2. log /dev/log local0
  3. log /dev/log local1 notice
  4. # chroot /var/lib/haproxy
  5. stats timeout 30s
  6. user haproxy
  7. group haproxy
  8. daemon
  9. external-check
  10. insecure-fork-wanted
  11. defaults
  12. log global
  13. option httplog
  14. option dontlognull
  15. option dontlog-normal
  16. timeout client 30s
  17. timeout server 30s
  18. timeout connect 5s
  19. # errorfile 400 /etc/haproxy/errors/400.http
  20. # errorfile 403 /etc/haproxy/errors/403.http
  21. # errorfile 408 /etc/haproxy/errors/408.http
  22. # errorfile 500 /etc/haproxy/errors/500.http
  23. # errorfile 502 /etc/haproxy/errors/502.http
  24. # errorfile 503 /etc/haproxy/errors/503.http
  25. # errorfile 504 /etc/haproxy/errors/504.http
  26. resolvers mydns
  27. nameserver dns1 1.1.1.1:53
  28. nameserver dns2 8.8.8.8:53
  29. resolve_retries 3
  30. timeout resolve 1s
  31. timeout retry 1s
  32. hold other 10s
  33. hold refused 10s
  34. hold nx 10s
  35. hold timeout 10s
  36. hold valid 10s
  37. hold obsolete 10s
  38. ##########################################################################################
  39. #FRONTENDS:
  40. ##########################################################################################
  41. ############## HTTP:
  42. frontend ft_http
  43. mode http
  44. bind *:80
  45. option httplog
  46. option forwardfor
  47. #ACL:
  48. acl geobaldemo-burdigone_http hdr_dom(host) -i geobaldemo.burdig.one
  49. #BACKENDS:
  50. use_backend bk_geobaldemo-burdigone_http if geobaldemo-burdigone_http
  51. ############ HTTPS_SNI:
  52. frontend ft_https_sni_global
  53. bind *:443
  54. mode tcp
  55. acl geobaldemo-burdigone_https req.ssl_sni -i geobaldemo.burdig.one
  56. use_backend bk_geobaldemo-burdigone_https if geobaldemo-burdigone_https
  57. tcp-request inspect-delay 2s
  58. tcp-request content reject if !geobaldemo-burdigone_https
  59. ##########################################################################################
  60. #BACKENDS:
  61. ##########################################################################################
  62. backend bk_redirect_https
  63. mode http
  64. redirect scheme https if !{ ssl_fc }
  65. backend bk_geobaldemo-burdigone_https
  66. mode tcp
  67. server srv-geobaldemo-burdigone_https 127.0.0.1:10443 check sni req.ssl_sni
  68. backend bk_geobaldemo-burdigone_http
  69. mode http
  70. server srv-geobaldemo-burdigone_http 127.0.0.1:8000 check
  71. listen stats
  72. bind *:9000
  73. mode http
  74. stats enable
  75. stats uri /stats
  76. stats realm HAProxy\ Statistics
  77. stats refresh 20s
  78. stats show-node
  79. stats show-legends
  80. stats show-desc HAPROXY
  81. stats auth admin:Passw0rd
  82. stats admin if TRUE
  83. #Hello!