Benutzer-Werkzeuge

Webseiten-Werkzeuge


haproxy

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
haproxy [2025/10/27 19:30]
jango [Kompilieren]
haproxy [2025/10/29 09:24] (aktuell)
jango [ACL]
Zeile 2: Zeile 2:
  
 =====Installation===== =====Installation=====
 +
 +  * Service Ubuntu: /lib/systemd/system/haproxy.service
 +  * Service RHEL: /etc/systemd/system/haproxy.service
  
 <box red>In den meissten Distributionen installiert der Paketmanager eine veraltete Version (1.8)</box> <box red>In den meissten Distributionen installiert der Paketmanager eine veraltete Version (1.8)</box>
Zeile 70: Zeile 73:
  
 <code> <code>
-# Fix+# Fix not needed
 setcap 'cap_net_bind_service=+ep' /usr/sbin/haproxy setcap 'cap_net_bind_service=+ep' /usr/sbin/haproxy
 </code> </code>
Zeile 76: Zeile 79:
  
 <code> <code>
-haproxy -f /etc/haproxy/haproxy.cfg+haproxy -f /etc/haproxy/haproxy.cfg [-Ws]
 haproxy -db -f /etc/haproxy/haproxy.cfg haproxy -db -f /etc/haproxy/haproxy.cfg
 </code> </code>
Zeile 327: Zeile 330:
  
 Siehe [[https://serverfault.com/questions/1193486/how-to-configure-health-check-for-postfix-behind-haproxy-when-using-the-proxy-pr]] Siehe [[https://serverfault.com/questions/1193486/how-to-configure-health-check-for-postfix-behind-haproxy-when-using-the-proxy-pr]]
 +=====ACL=====
 +
 +ACL geben true oder false zurück. Die ACL kann dann in jeder Zeile angewendet werden die ein conditional if or unless statement abfragt. Siehe [[https://www.haproxy.com/documentation/haproxy-configuration-tutorials/proxying-essentials/custom-rules/acls/|ACL Dokumentation]]
 +
 +<code>
 +frontend www
 +   bind :80
 +   acl images_url path_beg -i /images/
 +   use_backend static_assets if images_url
 +</code>
 +
 +=====Fetches=====
 +
 +[[https://www.haproxy.com/documentation/haproxy-configuration-tutorials/proxying-essentials/custom-rules/fetches/|Fetch Dokumentation]]
 +
 +Eine Funktion, die Informationen über die aktuelle Anfrage, die aktuelle Antwort, die Verbindung oder den internen Zustand des Load Balancers zurückgibt. 
 +
 +<code>
 +frontend www
 +  bind :80
 +  http-request deny if { path /api/bad/ }
 +</code>
 +
 +<code>
 +frontend www
 +  bind :80
 +  http-request set-var(txn.http_version) req.ver
 +  http-response add-header Via "%[var(txn.http_version)] %[hostname]"
 +</code>
 +=====Persistence=====
 +
 +====Stick Table====
 +
 +Siehe [[https://www.haproxy.com/documentation/haproxy-configuration-tutorials/proxying-essentials/custom-rules/stick-tables/|Stick Table Dokumentation]]
 +
 +<code>
 +# Track src IP, max 1Mill entries expire after 30m
 +backend app_servers
 +    stick-table type ip size 1m expire 30m
 +    stick on src
 +    server app1 192.168.1.10:80 check
 +    server app2 192.168.1.11:80 check
 +</code>
 +
 =====Links===== =====Links=====
  
haproxy.1761589834.txt.gz · Zuletzt geändert: 2025/10/27 19:30 von jango