derFelix244

haproxy-cfg2

Jun 18th, 2026 (edited)
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. global
  2. log /dev/log local0
  3. log /dev/log local1 notice
  4. chroot /var/lib/haproxy
  5. stats socket /run/haproxy/admin.sock mode 660 level admin
  6. stats timeout 30s
  7. user haproxy
  8. group haproxy
  9. daemon
  10.  
  11. # Default SSL material locations
  12. ca-base /etc/ssl/certs
  13. crt-base /etc/ssl/private
  14.  
  15. # See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
  16. ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
  17. ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
  18. ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
  19.  
  20. defaults
  21. log global
  22. mode http
  23. http-reuse safe
  24. option httplog
  25. option dontlognull
  26. timeout connect 5
  27. timeout client 3600
  28. timeout server 3600
  29. compression algo gzip
  30. errorfile 400 /etc/haproxy/errors/400.http
  31. errorfile 403 /etc/haproxy/errors/403.http
  32. errorloc 404 https://thispagedoesnotexist.mydomain.dev
  33. errorfile 408 /etc/haproxy/errors/408.http
  34. errorfile 500 /etc/haproxy/errors/500.http
  35. errorfile 502 /etc/haproxy/errors/502.http
  36. errorloc 503 https://somethinghappened503.mydomain.dev
  37. errorfile 504 /etc/haproxy/errors/504.http
  38.  
  39. frontend www-https
  40. bind *:443 ssl crt /etc/haproxy/ssl/mydomain.dev/cert.pem
  41. acl letsencrypt-acl path_beg /.well-known/acme-challenge/
  42. use_backend letsencrypt-backend if letsencrypt-acl
  43.  
  44. compression offload
  45.  
  46. http-request set-header X-Forwarded-Proto https
  47. http-request set-header X-Forwarded-Host %[req.hdr(Host)]
  48. http-request set-header X-Client-IP req.hdr_ip([X-Forwarded-For])
  49. http-request add-header X-Forwarded-Port 443
  50. http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"
  51.  
  52. acl portainer hdr(host) -i portainer.mydomain.dev
  53. acl pve hdr(host) -i proxmox.mydomain.dev
  54.  
  55. use_backend portainer if portainer
  56. use_backend pve if pve
  57.  
  58. default_backend www-backend
  59.  
  60. frontend www-http
  61. bind *:80
  62. http-request set-header X-Forwarded-Proto http
  63. http-request set-header X-Forwarded-Host %[req.hdr(Host)]
  64.  
  65. default_backend www-backend
  66.  
  67. backend letsencrypt-backend
  68. server letsencrypt 127.0.0.1:54321
  69.  
  70. backend portainer
  71. option httpchk GET /
  72. http-check expect status 200
  73. server portainer 192.168.1.6:9443 check inter 2s ssl verify none
  74.  
  75. backend pve
  76. #option httpchk GET /
  77. #http-check expect status 200
  78. option http-server-close
  79. #cookie SERVER insert indirect nocache
  80. option forwardfor
  81. #stick-table type ip size 50k expire 30m
  82. #stick on src
  83.  
  84. server pve 192.168.0.10:8006
  85. #server pve 192.168.0.10:8006 ssl verify required ca-file /etc/haproxy/ssl/mydomain.dev/cert.pem
  86. #server pve 192.168.0.10:8006 ssl sni hdr(host) verify none
  87. #server pve 192.168.0.10:8006 ssl verify none
  88.  
  89. backend www-backend
  90. http-request redirect scheme https code 301 unless { ssl_fc }
  91. server notfound 127.0.0.1:40404
Advertisement
Add Comment
Please, Sign In to add comment