haproxy终于还是打算直接支持ssl了,目前是放出了一个测试版本的。简单的测试了一下,现在是可以跑起来的。
[测试版本](http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120904.tar.gz)globallog 127.0.0.1 local1 noticemaxconn 40960uid 99gid 99nbproc 4daemonstats socket /opt/haproxyssl/haproxy.stats level admin
```bash
defaultslog globalmode httpoption dontlognullretries 3option redispatchmaxconn 2000contimeout 5000clitimeout 50000srvtimeout 50000frontend httpsbind-process 1,2bind :443 ssl /opt/haproxyssl/cert2/mulapp.crtdefault_backend httpbackend httpbind-process 3mode httpserver pp1 127.0.0.1:80 weight 10 check inter 2000 rise 2 fall 4listen stats 0.0.0.0:8000maxconn 10bind-process 4mode httpstats refresh 30sstats uri /statsstats realm haproxystats auth admin:admin
目前还没有证书的文档说明具体怎么用,只是邮件列表有提到,就照着配置了一下。可以使用bind-process把负责接收请求和ssl加解密的单独绑定到特定的进程。bind后面的ssl指令是指定ssl证书的,需要注意的是证书的格式是和stunnel用的类似的。对于证书链的配置是把依次把服务器证书,…,根证书追加到文件,然后再 把key追加到最后,我也试过直接把key放最前面也是可以的,看来是可以自动识别出来的。