http01 챌린지를 위한 임시 nginx 설정 및 nginx 컨테이너에 webroot 볼륨 설정
certbot 명령
sudo certbot certonly --webroot -w /home/ubuntu/nginx/webroot -d [api.momonow.kr](<http://api.momonow.kr/>)
ssl nginx 설정
헬스 체크와 모니터링을 위한 경로는 http로 요청오기 떄문에 80포트로 설정.
api 경로만 443 포트, https 적용
ssl_certificate /etc/letsencrypt/live/api.momonow.kr/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.momonow.kr/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl 설정을 위한 nginx 컨테이너 볼륨 설정
volumes: + ssl:/etc/letsencrypt
crontab 매월 1일 인증서 renew 후 nginx reload 설정
0 0 1 * * certbot renew --post-hook "sudo docker exec nginx nginx -s reload”
자료
https://eff-certbot.readthedocs.io/en/stable/using.html#webroot
https://letsencrypt.org/ko/docs/challenge-types/
https://www.ssl.com/ko/article/what-is-the-acme-protocol/#ftoc-heading-2
인증서 발급 받은 방식이 그대로 갱신에 사용됨. 하지만 열어둔 경로를 닫아 두었기에 http01 챌린지가 실패하여 갱신 실패.
우선 서비스가 돌아가야하니 발급 받을 당시 설정을 그대로 사용해봄