Ubuntu Server / Let’s Encrypt 무료 SSL 인증서 발급 받기
Ubuntu
2021-03-08
Ubuntu Server에서 Apache Web Server를 사용하는 경우 Let’s Encrypt 인증서 발급 받는 방법입니다.
차례
Apache용 Certbot 설치
Ubuntu Server 18.04, Ubuntu Server 20.04
apt install software-properties-common add-apt-repository universe add-apt-repository ppa:certbot/certbot apt update apt upgrade apt install certbot python3-certbot-apache
Ubuntu Server 16.04
add-apt-repository ppa:certbot/certbot apt update apt upgrade apt install python-certbot-apache
인증서 발급
- abc.com 인증서 발급하고 설정 파일 생성
certbot --apache -d abc.com
- abc.com과 www.abc.com 인증서 동시 발급하고 설정 파일 생성
certbot --apache -d abc.com -d www.abc.com
- abc.com 인증서만 발급
certbot certonly --apache -d abc.com
인증서 갱신
Let’s Encrypt 인증서 유효 기간은 90일이고, 만료일 30일 전부터 갱신이 가능합니다.
- 갱신 가능한 인증서 갱신
certbot renew
인증서 삭제
- abc.com 인증서 삭제
certbot delete --cert-name abc.com
Cron으로 자동 갱신
- crontab에 다음을 추가하면 매일 새벽 4시에 갱신을 시도합니다.
0 4 * * * certbot renew --post-hook "service apache2 reload"