当前位置:   article > 正文

ha 配置ssl_haproxy ssl 配置方式-阿里云开发者社区

阿里的域名证书 哪个可以给 haproxy 用的

haproxy 代理 ssl 有两种方式

1、haproxy 本身提供ssl 证书,后面的web 服务器走正常的http

2、haproxy 本身只提供代理,后面的web服务器https

第一种方式

需要编译haproxy 支持ssl,编译参数:

make TARGET=linux26 USE_OPENSSL=1 ADDLIB=-lz

ldd haproxy | grep ssl

libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007fb0485e5000)

配置参数:

frontend https_frontend

bind *:443 ssl crt /etc/ssl/certs/servername.pem

mode http

option httpclose

option forwardfor

reqadd X-Forwarded-Proto:\ https

default_backend web_server

backend web_server

mode http

balance roundrobin

cookie SERVERID insert indirect nocache

server s1 192.168.250.47:80 check cookie s1

server s2 192.168.250.49:80 check cookie s2

注意:这里的pem 文件是下面两个文件合并而成:

cat servername.crt servername.key |tee servername.pem

第二种方式配置

不需要重新编译支持ssl,简单方便。需要后面的web服务器配置好ssl 即可。

frontend https_frontend

bind *:443

mode tcp

default_backend web_server

backend web_server

mode tcp

balance roundrobin

stick-table type ip size 200k expire 30m

stick on src

server s1 192.168.250.47:443

server s2 192.168.250.49:443

本文转自aaron428 51CTO博客,原文链接:http://blog.51cto.com/aaronsa/1741517,如需转载请自行联系原作者

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/987944
推荐阅读
相关标签
  

闽ICP备14008679号