Nginx Let's Encrypt SSL 적용하기
실행 환경
- Ubuntu 20.04 / Docker: Ubuntu 20.04 이미지 적용
- nginx에는 이미 http로 도메인 연결이 되어 있다고 가정한다.
CERTBOT 적용하여 Let's Encrypt SSL 적용하기
# 설치
$ apt-get install letsencrypt
$ apt-get install python3-certbot-nginx
$ apt-get install certbot
# SSL 인증서 등록
$ certbot --nginx
or
$ certbot --nginx -d [적용할 사이트 이름]
$ service nginx restart
or
$ systemctl restart nginx
# 3개월에 한번씩 갱신 필요
# 테스트 갱신
$ certbot renew --dry-run
# 실제 갱신
$ certbot renew
Crontab을 사용하여 자동 갱신
# Docker일 경우 crontab 설치 필요
$ apt-get install cron
# Crontab 편집
$ crontab -e
(매월 1일 오전 5시에 실행) - 자세한건 참고링크에서 확인해주세요!
0 5 1 * * /usr/bin/certbot renew --renew-hook="service nginx restart"
# Crontab 보기
$ crontab -l
참고링크
https://nuggy875.tistory.com/119
Nginx로 https 적용하기 (let's encrypt 사용)
- Ubuntu 18.04 LTS 에서 진행 - Ubuntu 20.04 에서 실행 시에도 문제 없었음. - 보유 DNS가 있어야 진행할 수 있음. greenlock 방식이 불안하다는 얘기가 많아서 리버스 프록시 방식의 Nginx를 사용하여 https 인
nuggy875.tistory.com
https://nuggy875.tistory.com/133
https 인증서 자동 갱신 (Let's Encrypt) (Crontab사용)
https 인증서 발급 및 수동 갱신 방법 https://nuggy875.tistory.com/119 Nginx로 https 적용하기 (let's encrypt 사용) - Ubuntu 18.04 LTS 에서 진행 - Ubuntu 20.04 에서 실행 시에도 문제 없었음. - 보유 DNS가 있어야 진행
nuggy875.tistory.com
https://freedeveloper.tistory.com/264
[Docker] Crontab 설치
https://codeday.me/ko/qa/20190325/152387.html Cron Job * * * * * root echo "Hello world" >> /var/log/cron.log 2>&1 Dockerfile FROM ubuntu:latest MAINTAINER docker@ekito.fr RUN apt-get update && apt-get -y install cron # Add crontab file in the cron directo
freedeveloper.tistory.com
'Ubuntu' 카테고리의 다른 글
Ubuntu 22.04 LTS에 MongoDB 설치하기 (0) | 2023.11.26 |
---|