今天測(cè)試配置haproxy代理https,一直報(bào)錯(cuò),后來(lái)發(fā)現(xiàn),后端已經(jīng)是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 h6_f bind *:80 mode http log global use_backend h6_server frontend h6_w bind *:443 mode tcp log global use_backend h6_four backend h6_four mode tcp balance roundrobin server h6_f1 10.29.25.11:443 weight 1 maxconn 10000 check inter 10s server h6_f2 10.30.20.9:443 weight 1 maxconn 10000 check inter 10s backend h6_server mode http balance roundrobin server h6_one 10.29.25.11:80 weight 1 maxconn 10000 check inter 10s server h6_tow 10.30.20.9:80 weight 1 maxconn 10000 check inter 10s
如果后端沒(méi)有配置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 h6_f bind *:80 mode http log global use_backend h6_server frontend h6_w bind *:443 ssl crt /etc/haproxy/ckl.pem mode http log global use_backend h6_four backend h6_four mode http balance roundrobin server h6_f1 10.29.25.11:443 weight 1 maxconn 10000 check inter 10s server h6_f2 10.30.20.9:443 weight 1 maxconn 10000 check inter 10s backend h6_server mode http balance roundrobin server h6_one 10.29.25.11:80 weight 1 maxconn 10000 check inter 10s server h6_tow 10.30.20.9:80 weight 1 maxconn 10000 check inter 10s
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。