haproxy.cfg 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. global
  2. log 127.0.0.1 local0 info
  3. maxconn 4096
  4. defaults
  5. option dontlognull # Do not log connections with no requests
  6. option contstats # Enable continuous traffic statistics updates
  7. retries 3 # Try to connect up to 3 times in case of failure
  8. timeout connect 5s # 5 seconds max to connect or to stay in queue
  9. timeout http-keep-alive 1s # 1 second max for the client to post next request
  10. timeout http-request 15s # 15 seconds max for the client to send a request
  11. timeout queue 30s # 30 seconds max queued on load balancer
  12. timeout client 300s # 客户端超时时间设置为30秒,你可以根据需要调整这个值
  13. timeout connect 10s # 连接超时时间设置为10秒,你也可以根据需要调整
  14. timeout server 300s # 服务端超时时间设置为30秒,根据需要调整
  15. backlog 10000 # Size of SYN backlog queue
  16. frontend ftp_fe
  17. bind 0.0.0.0:20-21 name ftp-control
  18. bind 0.0.0.0:21100-21110 name ftp-data
  19. mode tcp
  20. option tcplog
  21. log global
  22. default_backend ftp_be21
  23. frontend web
  24. mode http
  25. option accept-invalid-http-request
  26. bind 0.0.0.0:443
  27. acl open_baidu hdr(host) -i openapi.baidu.com
  28. acl pan_baidu hdr(host) -i pan.baidu.com
  29. acl pcs_baidu hdr(host) -i pcs.baidu.com
  30. acl d_pcs_baidu hdr(host) -i d.pcs.baidu.com
  31. use_backend open_baidu_backend if open_baidu
  32. use_backend pan_baidu_backend if pan_baidu
  33. use_backend pcs_baidu_backend if pcs_baidu
  34. use_backend d_pcs_baidu_backend if d_pcs_baidu
  35. default_backend open_baidu_backend
  36. backend ftp_be21
  37. balance leastconn
  38. stick on src
  39. stick-table type ip size 100k expire 1h
  40. server ftp-server1 47.98.251.134 check port 21
  41. backend open_baidu_backend
  42. mode http
  43. option forwardfor header X-Real-IP
  44. option http-server-close
  45. server openbaidu openapi.baidu.com check port 443
  46. backend pan_baidu_backend
  47. mode http
  48. option forwardfor header X-Real-IP
  49. option http-server-close
  50. server server pan.baidu.com check port 443
  51. backend pcs_baidu_backend
  52. mode http
  53. option forwardfor header X-Real-IP
  54. option http-server-close
  55. server server pcs.baidu.com check port 443
  56. backend d_pcs_baidu_backend
  57. mode http
  58. option forwardfor header X-Real-IP
  59. option http-server-close
  60. server server d.pcs.baidu.com check port 443
  61. listen nvr
  62. bind *:200
  63. mode http
  64. server s1 192.168.3.200:80 check
  65. listen rtsp
  66. bind *:554
  67. mode tcp
  68. server s1 192.168.3.200:554 check
  69. listen car_plate
  70. bind *:98
  71. mode http
  72. server s98 192.168.3.98:80 check
  73. listen cops
  74. bind *:10166
  75. option http-server-close
  76. mode tcp
  77. server scops cops.uniquecharge.cn:2526 check
  78. listen registry
  79. bind *:5000
  80. option http-server-close
  81. mode tcp
  82. server zhl nas.fast-fun.cn:5000 check
  83. listen http_proxy
  84. bind *:6667
  85. option http-server-close
  86. mode tcp
  87. server zhl 10.10.64.1:6667 check