• 首页
  • 数据库
    • mysql
  • web服务器
    • nginx
    • Apache
  • 操作系统
    • Centos
    • Debian
    • Ubuntu
    • mac
    • windows
  • 编程语言
    • html
    • php
  • 集群
    • mycat
  • 其它
欢迎光顾我的个人博客
  1. 首页
  2. 文章
  3. 集群
  4. haproxy
  5. 正文

haproxy 配置https 443端口转发

2020年06月15日 1386点热度 0人点赞 0条评论

今天测试配置haproxy代理https,一直报错,后来发现,后端已经是https这里则不需要特别指定了

配置文件如下:

global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    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            h5_f
    bind            *:80
    mode            http
    log             global
    use_backend     h5_server


frontend            h5_w
    bind            *:443
    mode            tcp 
    log             global
    use_backend     h5_four

backend h5_four
    mode            tcp
    balance         roundrobin
    server  h5_f1 10.29.25.11:443 weight 1 maxconn 10000 check inter 10s
    server  h5_f2 10.30.20.9:443 weight 1 maxconn 10000 check inter 10s


backend h5_server
    mode            http
    balance         roundrobin
    server  h5_one  10.29.25.11:80 weight 1 maxconn 10000 check inter 10s
    server  h5_tow  10.30.20.9:80 weight 1 maxconn 10000 check inter 10s

如果后端没有配置https则需要

global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    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            h5_f
    bind            *:80
    mode            http
    log             global
    use_backend     h5_server


frontend            h5_w
    bind            *:443 ssl crt /etc/haproxy/ckl.pem
    mode            http 
    log             global
    use_backend     h5_four

backend h5_four
    mode            http 
    balance         roundrobin
    server  h5_f1 10.29.25.11:443 weight 1 maxconn 10000 check inter 10s
    server  h5_f2 10.30.20.9:443 weight 1 maxconn 10000 check inter 10s


backend h5_server
    mode            http
    balance         roundrobin
    server  h5_one  10.29.25.11:80 weight 1 maxconn 10000 check inter 10s
    server  h5_tow  10.30.20.9:80 weight 1 maxconn 10000 check inter 10s
标签: haproxy
最后更新:2020年07月15日

多洛夫

多看多想多研究,总会有创新

点赞
< 上一篇
下一篇 >

文章评论

取消回复

多洛夫

多看多想多研究,总会有创新

博客更新日期
2025 年 6 月
一 二 三 四 五 六 日
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« 7 月    
分类
标签聚合
Yandex ffmpeg 图片格式转换 mysql Google lls Termux wordpress Launchctl 谷歌浏览器插件 域名邮箱 mac google插件 Shell centos 视频截图 haproxy php DNS Photoshop

© 2020 多洛夫