Coolx World - Computer ???
Haproxy SSL 적용 (Internet일반)
2018-02-26 17:15 - swindler
-----------------실제설정파일--------------------

global
daemon
maxconn 256
log 127.0.0.1 local2 info
tune.ssl.default-dh-param 2048

defaults
option forwardfor
stats enable
stats uri /haproxy

mode http
timeout connect 5s
timeout server 50s
timeout client 50s

frontend http-in
bind *:80
bind *:443 ssl crt /xxxx/xxx.pem
default_backend servers
log global
option httplod
redirect scheme https if ! { ssl_fc }

backend servers
mode http
balance roundrobin
cookie SERVERID insert indirect nocache
server s1 1.1.1.1:8000 check inter 5000 fastinter 1000 rise 1 fall 1 weight 1
server s2 1.1.1.2:8000 check inter 5000 fastinter 1000 rise 1 fall 1 weight 1


* redirect scheme 부분이 http를 자동으로 https로 리다이렉트함

-----------------실제설정파일--------------------
인증서 파일을 하나로 통합해야 한다.

1. cat domain_xxxxx.key > unified.myssl.pem
2. cat domain_xxxxx.crt >> unified.myssl.pem
3. cat ca-bundle.pem >> unified.myssl.pem

개인키 / 서버인증서 / 체인,루트 인증서 통합 PEM 파일을 생성


frontend httpFrontEnd
bind *:443 ssl crt /etc/haproxy/certs/unified.myssl.pem
reqadd X-Forwarded-Proto:\ https


--------------------------
http를 https로 리다이렉트하는 것도 haproxy에서 할 수 있다.

redirect scheme https if !{ ssl_fc }



----------------
아래와 같이 사용하는 경우도 있음

frontend web-in
bind :443 ssl crt /etc/haproxy/server.pem ca-file /etc/haproxy/ca.crt
bind :80
default_backend web_backend

backend web_backend
balance roundrobin
# a http backend
server s1 naver.com:80
# a https backend
server s2 www.google.co.kr:443 ssl
swindler - 2018-02-26 17:43
ssl을 웹서버에서 처리하는건 아니고, 웹서버는 기본 80으로 처리하고 haproxy가 ssl을 처리한다.
Copyright © 1999-2020, swindler.

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog