1. 添加域名对应的 “服务器证书、ca证书、私钥” 到 [/etc/haproxy18/abc-net.pem]
2. 修改配置文件
# 注意:这个是一个简单项目的完整的配置文件,https协议配置部分,寻找 “*:443”即可
global
log 127.0.0.1 local2
chroot /var/lib/haproxy18
pidfile /var/run/haproxy18.pid
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy18/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 5m
timeout connect 10s
timeout client 5m
timeout server 5m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
frontend secure
bind *:8080
mode http
option httplog
log global
maxconn 10
stats enable
stats uri /admin?
stats auth admin:admin
stats hide-version
stats admin if TRUE
stats refresh 30s
frontend app
bind *:8000
mode http
use_backend app
backend app
balance roundrobin
server app1 10.3.0.200:30689 check
frontend bei_xiang
bind *:7601
mode http
use_backend bei_xiang
backend bei_xiang
balance roundrobin
server app1 10.3.0.200:32521 check
frontend ceshi-zhengshi
bind *:443 ssl crt /etc/haproxy18/abc-net.pem ciphers HIGH:!aNULL:!MD5
mode tcp
use_backend xiao-chengxu-ceshi if { ssl_fc_sni idcmpt.abc.net }
use_backend xiao-chengxu-zhengshi if { ssl_fc_sni idcmp.abc.net }
use_backend yemian-zhengshi if { ssl_fc_sni idc.abc.net }
use_backend fuwu-zhengshi if { ssl_fc_sni gwidc.abc.net }
backend xiao-chengxu-ceshi
balance roundrobin
server ceshi 10.3.0.200:31552 check inter 2000 fall 3
backend xiao-chengxu-zhengshi
balance roundrobin
server zhengshi 10.3.0.200:31051 check inter 2000 fall 3
backend yemian-zhengshi
balance roundrobin
server idc 10.3.0.200:32105 check inter 2000 fall 3
backend fuwu-zhengshi
balance roundrobin
server gw-idc 10.3.0.200:31740 check inter 2000 fall 3
3. 重启服务即可
systemctl restart haproxy18.service