Haproxy: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| (10 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 5: | Zeile 5: | ||
==== Konfiguration einer Weiterleitung von HTTP auf HTTPS ==== | ==== Konfiguration einer Weiterleitung von HTTP auf HTTPS ==== | ||
| − | + | <nowiki> | |
| − | + | # Define frontend | |
| − | + | frontend wiki_and_cloud | |
| − | + | mode http | |
| − | + | bind 192.168.1.100:80 | |
| − | frontend https_wiki_and_cloud | + | use_backend http_wiki_servers if { req.hdr(host) -i wiki.domain.de } |
| − | mode tcp | + | use_backend http_cloud_servers if { req.hdr(host) -i cloud.domain.de } |
| − | bind 192.168.1.100:443 | + | redirect scheme https code 301 |
| − | tcp-request inspect-delay 5s | + | |
| − | tcp-request content accept if { req_ssl_hello_type 1 } | + | frontend https_wiki_and_cloud |
| − | use_backend https_wiki_servers if { req_ssl_sni -i -i wiki.domain.de } | + | mode tcp |
| − | use_backend https_cloud_servers if { req_ssl_sni -i -i cloud.domain.de } | + | bind 192.168.1.100:443 |
| − | backend https_wiki_servers | + | tcp-request inspect-delay 5s |
| − | mode tcp | + | tcp-request content accept if { req_ssl_hello_type 1 } |
| − | option ssl-hello-chk | + | use_backend https_wiki_servers if { req_ssl_sni -i -i wiki.domain.de } |
| − | server s2 192.168.1.102:443 | + | use_backend https_cloud_servers if { req_ssl_sni -i -i cloud.domain.de } |
| − | backend https_cloud_servers | + | |
| − | mode tcp | + | backend https_wiki_servers |
| − | option ssl-hello-chk | + | mode tcp |
| − | server s1 192.168.1.103:443</nowiki | + | option ssl-hello-chk |
| − | + | server s2 192.168.1.102:443 | |
| + | |||
| + | backend https_cloud_servers | ||
| + | mode tcp | ||
| + | option ssl-hello-chk | ||
| + | server s1 192.168.1.103:443 | ||
| + | |||
| + | backend http_wiki_servers | ||
| + | mode http | ||
| + | server nc 192.168.1.102:80 | ||
| + | |||
| + | backend http_cloud_servers | ||
| + | mode http | ||
| + | server nc 192.168.1.103:80 | ||
| + | </nowiki> | ||
Aktuelle Version vom 23. Dezember 2022, 17:05 Uhr
HAProxy für viele Einsatzzwecke
- Load Balancer (Lastverteiler)
- Weiterleiten verschiedener Subdomains auf unterschiedliche Server
Konfiguration einer Weiterleitung von HTTP auf HTTPS
# Define frontend
frontend wiki_and_cloud
mode http
bind 192.168.1.100:80
use_backend http_wiki_servers if { req.hdr(host) -i wiki.domain.de }
use_backend http_cloud_servers if { req.hdr(host) -i cloud.domain.de }
redirect scheme https code 301
frontend https_wiki_and_cloud
mode tcp
bind 192.168.1.100:443
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend https_wiki_servers if { req_ssl_sni -i -i wiki.domain.de }
use_backend https_cloud_servers if { req_ssl_sni -i -i cloud.domain.de }
backend https_wiki_servers
mode tcp
option ssl-hello-chk
server s2 192.168.1.102:443
backend https_cloud_servers
mode tcp
option ssl-hello-chk
server s1 192.168.1.103:443
backend http_wiki_servers
mode http
server nc 192.168.1.102:80
backend http_cloud_servers
mode http
server nc 192.168.1.103:80