"What would you be if you were attached to another object by an inclined plane, wrapped helically around an axis?"
"Screwed."
"There you go."
The Big Bang Theory Season 4 Episode 5
Created by Marcus Rückert or just darix ;)
haproxy-1.5 package in server:http
Warning: All examples are tested with 1.5 only. They might work with 1.4 though.
global
maxconn 32768
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
option redispatch
retries 3
maxconn 10000
timeout connect 5000
timeout client 50000
timeout server 450000
apply to all blocks following unless overwritten.
listen stats
bind :80
stats enable
stats uri /
stats refresh 5s
Hover over values with dotted underline to get more detailed stats
listen proxy-http
bind :8080
server stats01 127.0.0.1:80
listen proxy-tcp
bind :8081
mode tcp
option tcplog
server stats01 127.0.0.1:80
frontend fe-stats
bind :8082
default_backend stats
backend be-stats
stats enable
stats uri /
stats refresh 5s
frontend fe-routing
bind :8083
acl is_localhost hdr(host) -i localhost
use_backend be-stats if is_localhost
default_backend be-lighty
backend be-lighty
option forwardfor
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost
server lighty2 127.0.0.1:81 check
server lighty1 127.0.0.1:82 check
Add this to the initial listen block. The bind statement should be one line without the backslashes.
haproxy.pem contains key, cert, chain certs, dh parameters.
bind :443 tfo ssl crt \
/etc/ssl/private/haproxy.pem no-sslv3 \
npn http/1.1,http/1.0 \
ciphers HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH
acl is_ssl ssl_fc
acl is_stats hdr(host) -i stats.example.com
redirect code 301 prefix https://stats.example.com if is_stats !is_ssl
reqidel ^X-Forwarded-(Proto|Ssl).*
reqidel ^HTTPS.*
reqadd HTTPS:\ on if is_ssl
reqadd X-Forwarded-Ssl:\ on if is_ssl
reqadd X-Forwarded-Proto:\ https if is_ssl
reqadd X-Forwarded-Protocol:\ https if is_ssl
reqadd X-Forwarded-Proto:\ http unless is_ssl
reqadd X-Forwarded-Protocol:\ http unless is_ssl
rspadd Strict-Transport-Security:\ max-age=31536000 if is_ssl
listen mysql
bind :3306
timeout client 5m
timeout connect 10s
timeout server 5m
mode tcp
option tcplog
option mysql-check user haproxy_check
server mysql1 192.168.0.1:3306 check backup
server mysql2 192.168.0.2:3306 check
syslog based
log 127.0.0.1 daemon info
log-send-hostname <hostname>-haproxy
option log-health-checks
option log-separate-errors
option dontlog-normal
This example will only log error cases but not normal requests.
virtualization cluster for openSUSE infrastructure
HTTP(S), git, MySQL
For ssh we are using xinetd