There are two ways of Haproxy proxy SSL
1, Haproxy itself provides SSL certificate, the back of the Web server go normal http
2, Haproxy itself only provide proxy, the back of the Web server https
The first way
Need to compile Haproxy support SSL, compile parameters:
Make target=linux26 use_openssl=1 Addlib=-lz
LDD Haproxy | grep SSL
libssl.so.10 =/usr/lib64/libssl.so.10 (0x00007fb0485e5000)
Configuration parameters:
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
Note: The Pem file here is a combination of the following two files:
Cat Servername.crt Servername.key |tee Servername.pem
The second way of configuring
No need to recompile to support SSL, simple and convenient. The following Web server is required to configure 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
Note that mode must be in the TCP mode
This article is from the "My Ops Time" blog, so be sure to keep this source http://aaronsa.blog.51cto.com/5157083/1741517
Haproxy SSL Configuration method