certbot을 사용하여 HAProxy에 SSL 인증서 추가

certbot을 사용하여 HAProxy에 SSL 인증서 추가

Nginx 서버를 기본 로드 밸런서로 구성하려고 합니다. certbot을 사용하여 필요한 패키지를 설치했는데 haproxy.cfg 파일을 구성하려고 하면 문제가 발생합니다.

모든 기본 haproxy 구성은 변경되지 않은 상태로 유지되므로 다음 줄을 추가했습니다.

frontend www-https-frontend
    bind *:80
    bind *:443 ssl crt /etc/letsencrypt/archive/www.example.tech/fullchain.pem
    http-request redirect scheme https unless { ssl_fc }
    http-request set-header X-Forwarded-Proto https

    default_backend www-backend

backend www-backend
    balance roundrobin
    server web-01 54.90.15.228:80 check
    server web-02 35.153.66.157:80 check

하지만 sudo haproxy -c -f /etc/haproxy/haproxy.cfg를 실행하면 다음 오류가 발생합니다.

[NOTICE]   (70084) : haproxy version is 2.5.14-1ppa1~focal
[NOTICE]   (70084) : path to executable is /usr/sbin/haproxy
[ALERT]    (70084) : config : parsing [/etc/haproxy/haproxy.cfg:39] : 'bind *:443' : unable to stat SSL certificate from file '/etc/letsencrypt/archive/www.codingbro.tech/fullchain.pem' : No such file or directory.
[ALERT]    (70084) : config : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT]    (70084) : config : Fatal errors found in configuration.

인증서를 생성할 때 전체 체인에 대한 정확한 경로를 제공합니다 /etc/letsencrypt/archive/www.example.tech/fullchain.pem. 어떤 도움이라도 대단히 감사하겠습니다.

ベストアンサー1

일반적으로 아카이브 디렉터리를 사용하면 안 됩니다. 현재 SSL 파일은 심볼릭 링크되어 있으므로 이를 사용해야 합니다. nginx의 경우 cfg 문은 다음과 같습니다.

ssl_certificate     /etc/letsencrypt/live/www.example.tech/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.tech/privkey.pem

haproxy와 동등한 것이 무엇인지 모르겠습니다.

おすすめ記事