Ubuntu 连接到https后端服务器的Haproxy 1.4
我正在尝试使用端口443通过https连接到2个后端服务器,我想找到一种方法将密钥和证书文件发送到后端服务器。我的haproxy.cfg是:Ubuntu 连接到https后端服务器的Haproxy 1.4,ubuntu,ssl,https,openssl,haproxy,Ubuntu,Ssl,Https,Openssl,Haproxy,我正在尝试使用端口443通过https连接到2个后端服务器,我想找到一种方法将密钥和证书文件发送到后端服务器。我的haproxy.cfg是: global log 127.0.0.1 local0 log 127.0.0.1 local1 notice #log loghost local0 info maxconn 4096 #chroot /usr/share/haproxy user haproxy group hapr
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen stats :8000
#mode http
stats enable
stats realm Haproxy\ Statistics
stats uri /
stats auth admin:password
listen ssl-relay :80
mode tcp
balance roundrobin
stick-table type ip size 200m expire 30m
stick on src
server server01 www.example.com:443 check inter 2000 fall 3
server server02 www.example.com:443 check inter 2000 fall 3
我们如何确保haproxy服务器和后端服务器之间的通信安全 haproxy 1.4不支持SSL。要么更新到1.5,要么考虑使用stunnel之类的工具 我已经在一个非常大的企业实现中使用了这两种产品,而且这两种产品都工作得很好。如果你想坚持使用haproxy 1.4,那么特技路线非常简单。只需在haproxy服务器上安装stunnel,监听本地端口,让haproxy连接到该本地端口,然后将stunnel配置为指向远程https端点。除了stunnel中的全局设置外,实际配置将是3行
您的客户端是否将用作url?如果没有,那么你所做的基本上是毫无意义的。您正在处理与前端的未加密连接,然后是与后端的加密连接。问题是,当连接返回到客户端时,它将是未加密的,因此您不会为自己购买任何东西。如果您的客户端将使用,那么就没有什么可做的了,因为haproxy将已经充当https流量的传递 您是否正在尝试在负载平衡器上执行SSL终止,如果是这样,您是在反向执行 你的绑定密码看起来像
frontend ssl-site
bind *:443 ssl crt /path/to/bundle.pem #you need to make sure the whole cert path is in one pem file
reqadd X-Forwarded-Proto:\ https
default_backend myServers
backend myServers
balance roundrobin
server server1 www.example.com:80
server server2 www2.example.com:80
但正如dtorgo所述,这种方式的ssl终止只适用于1.5及以上版本。如果你发现stunnel太慢,另一个选择是螺柱
希望这能帮你解决问题