haproxy ssl 支持

参考配置

global
     log         127.0.0.1 local2
    tune.ssl.default-dh-param 2048 # 此选项还是比较重要的,不然会有提示信息的(主要是安全问题)
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
    # turn on stats unix socket
    stats socket /var/lib/haproxy/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           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000
 
frontend  main
    bind :80    
    bind :443 ssl crt /etc/haproxy/app.pem  # 证书文件,注意是包含了证书公钥以及私钥的合并(使用 cat 组合就可以了。。)
    default_backend             app
backend app
    server  app1 127.0.0.1:8080

说明

核心比较简单,主要是ssl 以及crt 配置,如果需要支持http2的话,就需要添加 alpn h2,http/1.1 了(最好同时支持http1.1 以及http2)
对于crt 需要是合并的,通过cat 或者复制到一起就行了

参考资料

https://www.haproxy.com/blog/haproxy-ssl-termination/
https://ssl-config.mozilla.org/
https://www.haproxy.com/documentation/hapee/latest/load-balancing/protocols/http-2/

posted on   荣锋亮  阅读(136)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-12-03 fatih/pool golang tcp 连接池工具
2020-12-03 savsgio/kratgo 基于fasthttp 开发的一个cache proxy 服务
2020-12-03 golang race && vet 工具
2020-12-03 golang 条码操作的几个工具包
2020-12-03 quicktemplate 高性能的golang模版引擎
2020-12-03 brew 修改镜像源
2020-12-03 基于rust 编写的高性能全文检索服务

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示