haproxy.cfg 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. default_backend open_baidu
  28. backend ftp_be21
  29. balance leastconn
  30. stick on src
  31. stick-table type ip size 100k expire 1h
  32. server ftp-server1 47.98.251.134 check port 21
  33. backend open_baidu
  34. mode http
  35. option forwardfor header X-Real-IP
  36. option http-server-close
  37. server openbaidu openapi.baidu.com check port 443
  38. listen nvr
  39. bind *:200
  40. mode http
  41. server s1 192.168.3.200:80 check
  42. listen rtsp
  43. bind *:554
  44. mode tcp
  45. server s1 192.168.3.200:554 check
  46. listen car_plate
  47. bind *:98
  48. mode http
  49. server s98 192.168.3.98:80 check
  50. listen cops
  51. bind *:10166
  52. option http-server-close
  53. mode tcp
  54. server scops cops.uniquecharge.cn:2526 check
  55. listen registry
  56. bind *:5000
  57. option http-server-close
  58. mode tcp
  59. server zhl nas.fast-fun.cn:5000 check