haproxy.cfg 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Production HAProxy Configuration Example
  2. # This can be used with HttpHound's production mode
  3. global
  4. daemon
  5. maxconn 4096
  6. log /dev/log local0
  7. log /dev/log local1 notice
  8. # chroot /var/lib/haproxy
  9. # stats socket /run/haproxy/admin.sock mode 660 level admin
  10. stats timeout 30s
  11. defaults
  12. log global
  13. mode http
  14. option httplog
  15. option dontlognull
  16. timeout connect 5000
  17. timeout client 50000
  18. timeout server 50000
  19. # Frontend - receives client requests
  20. frontend web_frontend
  21. bind *:80
  22. #bind *:443 ssl crt /etc/ssl/certs/haproxy.pem
  23. # ACLs
  24. acl is_api path_beg /api
  25. acl is_static path_beg /static /images /css /js
  26. # Routing
  27. use_backend api_backend if is_api
  28. use_backend static_backend if is_static
  29. default_backend app_backend
  30. # Backend - application servers
  31. backend app_backend
  32. balance roundrobin
  33. option httpchk GET /health
  34. http-check expect status 200
  35. # These will be patched by HttpHound in production mode
  36. server app1 10.0.1.10:8080
  37. server app2 10.0.1.11:8080
  38. server app3 10.0.1.12:8080
  39. # API backend
  40. backend api_backend
  41. balance leastconn
  42. option httpchk GET /api/health
  43. server api1 10.0.2.10:9000 check
  44. server api2 10.0.2.11:9000 check
  45. # Static content backend
  46. backend static_backend
  47. balance roundrobin
  48. server static1 10.0.3.10:80 check
  49. server static2 10.0.3.11:80 check
  50. # Stats page
  51. listen stats
  52. bind *:8404
  53. stats enable
  54. stats uri /stats
  55. stats refresh 30s
  56. stats admin if TRUE