forked from evolix/ansible-roles
98 lines
2.6 KiB
Django/Jinja
98 lines
2.6 KiB
Django/Jinja
# {{ ansible_managed }}
|
|
|
|
global
|
|
log /dev/log local0
|
|
log /dev/log local1 notice
|
|
chroot {{ haproxy_chroot }}
|
|
stats socket {{ haproxy_socket }} 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
|
|
|
|
# Go to https://ssl-config.mozilla.org/ and build your SSL configuration
|
|
|
|
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
|
|
|
|
{% if haproxy_stats_enable %}
|
|
{% if haproxy_stats_users %}
|
|
userlist stats_users
|
|
{% for user in haproxy_stats_users | default([]) %}
|
|
user {{ user.login }} password {{ user.password }}
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
listen stats
|
|
mode http
|
|
bind {{ haproxy_stats_bind_directive }}
|
|
{% if haproxy_stats_internal_enable %}
|
|
bind {{ haproxy_stats_internal_host }}:{{ haproxy_stats_internal_port }}
|
|
{% endif %}
|
|
|
|
acl stats_access_ips src -f /etc/haproxy/stats_access_ips
|
|
acl stats_admin_ips src -f /etc/haproxy/stats_admin_ips
|
|
|
|
stats enable
|
|
stats refresh 10s
|
|
stats uri {{ haproxy_stats_path }}
|
|
stats show-legends
|
|
stats show-node
|
|
stats admin if stats_admin_ips
|
|
|
|
{% if haproxy_stats_users %}
|
|
acl stats_users http_auth(stats_users)
|
|
stats http-request auth realm "HAProxy admin" if !stats_access_ips !stats_users
|
|
{% else %}
|
|
stats http-request deny if !stats_access_ips !stats_admin_ips
|
|
{% endif %}
|
|
|
|
http-request set-log-level silent
|
|
{% endif %}
|
|
|
|
# frontend http-https
|
|
# bind 0.0.0.0:80
|
|
# bind 0.0.0.0:443 ssl crt {{ haproxy_ssl_dir }}
|
|
#
|
|
# capture request header Host len 32
|
|
#
|
|
# option forwardfor
|
|
#
|
|
# acl self hdr(host) -i {{ ansible_fqdn }}
|
|
#
|
|
# # Detect Let's Encrypt challenge requests
|
|
# acl letsencrypt path_dir -i /.well-known/acme-challenge
|
|
#
|
|
# # Reject the request at the TCP level if source is in the denylist
|
|
# tcp-request connection reject if { src -f /etc/haproxy/deny_ips }
|
|
#
|
|
# http-request set-header X-Forwarded-Proto https if { ssl_fc }
|
|
# http-request set-header X-Forwarded-Port 443 if { ssl_fc }
|
|
#
|
|
# use_backend local if letsencrypt || self
|
|
#
|
|
# backend local
|
|
# mode http
|
|
# option forwardfor
|
|
#
|
|
# server localhost 127.0.0.1:81 send-proxy-v2
|