maxmin93 / my-blog-comments

comments repository for maxmin93.github.io
0 stars 0 forks source link

posts/2022-10-25-setup-amazon-linux-2/ #6

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

AWS Lightsail 에서 Amazon Linux 2 설정하기 | 태주네 블로그

AWS Lightsail 에서 Amazon Linux 2 를 선택하고 초기 설정 작업들을 기록합니다.

https://taejoone.jeju.onl/posts/2022-10-25-setup-amazon-linux-2/

maxmin93 commented 1 year ago

Stackoverflow - Certbot 도메인 재인증(renew) 하는 법

  1. nginx 정지
  2. certbot 인증 테스트 (dry-run)
  3. certbot 재인증 실행 (renew)
    • 인증 방법 : 1번 standalone 선택
    • Congratulations!
  4. nginx 시작
  5. 재인증 내용 확인 (90일간 유효)
# certbot v1.11 설치
sudo yum update -y
sudo yum install certbot python3-certbot-nginx

# 테스트
sudo systemctl stop nginx
sudo certbot renew --dry-run

# 재인증
sudo certbot certonly --force-renew -d demo.jeju.onl
# Select the appropriate number => 1

# 재시작
sudo systemctl start nginx
sudo certbot certificates
# ==> Certificate Name: demo.jeju.onl
# ==> Expiry Date: 2023-01-25 02:16:45+00:00 (VALID: 89 days)
maxmin93 commented 1 year ago

certbot 재인증 작업을 crontab 으로 스케줄 등록 해두기

크론탭 스케줄 위치는 '분, 시, 일, 월, 주(week)' 순서임

sudo crontab -e
# 매달 3일 오전 4시 5분에 실행
5 4 3 * * /usr/bin/certbot renew --quiet

[ `expr $(date +'%m') % 2` -eq 1 ] && echo "odd" || echo "even"
# ==> 홀수달이면 odd, 짝수달이면 even 출력