Skip to content

Instantly share code, notes, and snippets.

@Ranlvor
Created July 17, 2017 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ranlvor/09245d34dc03310c9f368cb337d65ce5 to your computer and use it in GitHub Desktop.
Save Ranlvor/09245d34dc03310c9f368cb337d65ce5 to your computer and use it in GitHub Desktop.
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
tune.ssl.default-dh-param 4096
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
stats enable
stats uri /haproxy?stats
#stats realm Strictly\ Private
#stats auth A_Username:YourPassword
#stats auth Another_User:passwd
frontend https
bind :::443 v4v6
mode tcp
tcp-request inspect-delay 30s
tcp-request content accept if { req_ssl_hello_type 1 }
option tcplog
use_backend raumzeitlabor.de_s if { req_ssl_sni -i raumzeitlabor.de }
use_backend git.raumzeitlabor.org_s if { req_ssl_sni -i git.raumzeitlabor.org }
default_backend www.raumzeitlabor.de_s
frontend http
bind :::80 v4v6
mode http
option forwardfor
use_backend letsencrypt if { path_beg /.well-known/acme-challenge/ } ! { hdr(host) -i git.raumzeitlabor.org }
http-request redirect scheme https if { hdr(host) -i raumzeitlabor.de } !{ path_beg /.well-known/acme-challenge/ }
use_backend chat.raumzeitlabor.org if { hdr(host) -i chat.raumzeitlabor.org }
default_backend www.raumzeitlabor.de
backend letsencrypt
server letsencrypt 127.0.0.1:402
backend www.raumzeitlabor.de
http-request redirect prefix https://raumzeitlabor.de
backend www.raumzeitlabor.de_s
mode tcp
server www.raumzeitlabor.de_s localhost:8001
frontend www.raumzeitlabor.de_offload
bind *:8001 ssl crt /etc/haproxy/ssl/www.raumzeitlabor.de
mode http
use_backend www.raumzeitlabor.de
backend raumzeitlabor.de
http-request redirect scheme https if !{ ssl_fc }
http-response set-header Strict-Transport-Security max-age=31536000
server raumzeitlabor.de 172.17.0.3:80
backend raumzeitlabor.de_s
mode tcp
server raumzeitlabor.de_s localhost:8003
frontend raumzeitlabor.de_offload
bind *:8003 ssl crt /etc/haproxy/ssl/raumzeitlabor.de
mode http
use_backend raumzeitlabor.de
backend git.raumzeitlabor.org
server git.raumzeitlabor.org 192.168.123.11:80
backend git.raumzeitlabor.org_s
mode tcp
server git.raumzeitlabor.org_s 192.168.123.11:443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment