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 [19/01/2020 - 09:37] thommie3haproxy [05/03/2024 - 10:52] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 ====== Allgemeine Konfiguration ====== ====== Allgemeine Konfiguration ======
  
-[[https://cbonte.github.io/haproxy-dconv/2.1/configuration.html|https://cbonte.github.io/haproxy-dconv/2.1/configuration.html]]+[[http://cbonte.github.io/haproxy-dconv/]] 
 + 
 +Konfiguration verifizieren 
 + 
 +<code> 
 +/usr/sbin/haproxy -c -V -f /etc/haproxy/haproxy.cfg 
 +</code> 
 + 
 +====== Aktuelle Versionen ====== 
 + 
 +https://haproxy.debian.net/ 
 + 
 +(Standard Focal hat nur V. 2.0) 
  
 ====== HAPROXY als SSL Accelerator ====== ====== HAPROXY als SSL Accelerator ======
  
-Vorteil: **keine separaten IP Adressen nötig!** Konzept: HAPROXY horcht auf 80 und 443, der Webserver horcht nur auf localhost, z.B: 127.0.0.1:82, 83, 84… HAPROXY erkennt Requests über den Host Header und leitet auf den entsprechenden Port auf localhost um. Zertifikate werden durch haproxy bereitgestellt ===== Frontend =====<code>+Vorteil: **keine separaten IP Adressen nötig!** Konzept: HAPROXY horcht auf 80 und 443, der Webserver horcht nur auf localhost, z.B: 127.0.0.1:82, 83, 84… HAPROXY erkennt Requests über den Host Header und leitet auf den entsprechenden Port auf localhost um. Zertifikate werden durch haproxy bereitgestellt 
 +===== frontend ===== 
 +<code>
  
 frontend default frontend default
Zeile 55: Zeile 70:
 ===== Konfiguration HAPROXY ===== ===== Konfiguration HAPROXY =====
  
-**frontend**<code>+**frontend** 
 +<code>
  
 frontend le-frontend frontend le-frontend
Zeile 85: Zeile 101:
   * ''–non-interactive –agree-tos –email admin@example.com''  - Make this non-interactive by saying as much, agreeing to the TOS, and informing LetsEncrypt of the email to use to send "YOUR CERT IS EXPIRING" notifications.   * ''–non-interactive –agree-tos –email admin@example.com''  - Make this non-interactive by saying as much, agreeing to the TOS, and informing LetsEncrypt of the email to use to send "YOUR CERT IS EXPIRING" notifications.
   * ''–http-01-port=8888''  - The Magic™. This tells the stand-alone server to listen on port 8888. Note that LetsEncrypt will //still//  send the authorization HTTP request over port **80**  and haproxy with redirrect requests over port 8888. The flag is ''http-01''  because it expects an ''HTTP''  request, NOT an ''HTTPS''  request.   * ''–http-01-port=8888''  - The Magic™. This tells the stand-alone server to listen on port 8888. Note that LetsEncrypt will //still//  send the authorization HTTP request over port **80**  and haproxy with redirrect requests over port 8888. The flag is ''http-01''  because it expects an ''HTTP''  request, NOT an ''HTTPS''  request.
-===== Zertifikate =====+===== Zertifikate zusammenbinden =====
  
 cert und key müssen in **einer Datei **vorliegen: cert und key müssen in **einer Datei **vorliegen:
Zeile 96: Zeile 112:
 </code> </code>
  
-==== Erneuern ====<code>+===== Erneuern =====
  
-''sudo certbot renew --tls-sni-01-port=8888''+Zertifikate werden über –force-renewal einmal pro Monat per cron über ein Shellscrip aktualisiert und neu zusammengebunden 
 +<code>
  
 +#!/usr/bin/env bash
 +
 +# Renew the certificate
 +certbot renew --force-renewal --tls-sni-01-port=8888
 +
 +# Concatenate new cert files, with less output (avoiding the use tee and its output to stdout)
 +bash -c "cat /etc/letsencrypt/live/forum.netzwissen.de/fullchain.pem /etc/letsencrypt/live/forum.netzwissen.de/privkey.pem> /etc/ssl/haproxy/forum.netzwissen.de.pem"
 +bash -c "cat /etc/letsencrypt/live/zammad.netzwissen.de/fullchain.pem /etc/letsencrypt/live/zammad.netzwissen.de/privkey.pem> /etc/ssl/haproxy/zammad.netzwissen.de.pem"
 +
 +# Reload  HAProxy
 +service haproxy reload
 +
 +</code>
 +
 +====== Domain Umleitung (301) ======
 +
 +<code>
 +acl demoredirect hdr_dom(host) -i demofolder.com
 +acl demoredirect hdr_dom(host) -i www.demofolder.com
 +http-request redirect location https://briansnelson.com/demofolder/ code 301 if demoredirect
 </code> </code>
  
  • haproxy.1579426672.txt.gz
  • Zuletzt geändert: 05/03/2024 - 10:52
  • (Externe Bearbeitung)