certbot은 Let’s Encrypt에서 제공하는, 무료로 SSL/TLS 인증서를 발급해주는 도구다.
sudo apt-glocet update
sudo apt install certbot
# certbot [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN]
sudo certbot certonly \\
--webroot --webroot-path=/var/www/certbot \\
--email [email] \\
--agree-tos \\
--no-eff-email \\
-d [domain]
certonly
: 인증서를 발급 받거나 갱신한다.--webroot
: 인증을 위한 파일들을 서버의 webroot
파일에 위치시킨다.-d [domain]
: --domain
--domains
인증 받을 도메인 이름을 지정한다.Let’s Encrypt에서 발급 받은 인증서의 유효기간은 90일이다. 따라서 주기적으로 인증서를 갱신해야 한다.
crontab -e
0 2 1 * * sudo certbot certonly --non-interactive --force-renewal --webroot --webroot-path=/var/www/certbot --email [email] --agree-tos --no-eff-email -d [domain] >> /var/log/certbot-renew.log 2>&1
--non-interactive
: 사용자 입력 없이 실행한다.