haproxy -vv
合成pem证书(申请好的证书下载nginx格式的):
cat test.com.crt test.com.key | tee test.com.pem
编辑配置文件(以自己实际配置文件位置为准):
vi /etc/haproxy/haproxy.cfg
#------------------------ test https -------------------------------------
frontend TEST
bind *:443 ssl crt /etc/haproxy/ssl/test,com.pem
mode http
acl TEST hdr_beg(host) -i test.com | www.test.com
use_backend TEST if TEST
backend TEST
mode http
option httpchk HEAD /TEST/haproxy.html #检测文件以自己的为准
balance roundrobin
server SVR1 appsvr1:8080 check inter 5s rise 3 fall 3
server SVR2 appsvr2:8080 check inter 5s rise 3 fall 3
检查配置文件:
haproxy -c -f /etc/haproxy/haproxy.cfg
Configuration file is valid
haproxy在线重启命令:
service haproxy reload
haproxy直接重启命令:
systemctl restart haproxy
haproxy状态查询命令:
systemctl status haproxy