# letsencrypt를 사용하므로 /etc/letsencrypt/.. 위치에 인증서가 있음
# 폐쇄적인 환경일 경우 갱신하기 전 AWS SecurityGroup의 inbound rule 수정이 필요할 수 있음
# 80(http), 443(https) port open 필요
# 갱신기일 체크
openssl s_client -connect localhost:443 2>/dev/null | openssl x509 -noout -dates
# 임시 작동 확인
certbot-auto renew --pre-hook "service nginx stop" --post-hook "service nginx start" --dry-run
# 갱신 (만료되기 7일 전에만 갱신이 됨, 그 이전에 할 경우 파일만 교체됨)
certbot-auto renew --pre-hook "service nginx stop" --post-hook "service nginx start"
# 강제 재발급
certbot-auto certonly --standalone --email {EMAIL_ADDRESS} -d {URL_HOST}