도메인까지 구매해 연결을 완료했으니 SSL 인증서를 적용한다.
Let's Encrypt를 이용해 진행한다.
http와 https의 차이점은 추후에 자세히 포스팅하기로하고 일단은 적용부터
1. Certbot 설치
yum install epel-release
yum install certbot
yum install python3-certbot-nginx
설치 확인
certbot --version
2. nginx.conf 설정
vi /etc/nginx/nginx.conf
server.server_name 에 도메인 입력
# nginx.conf test
nginx -t
# reload
systemctl restart nginx.service
이전 방화벽 오픈 때 https 기본 포트인 443도 오픈 해두었기 때문에 바로 인증서를 발급받으면 된다.
certbot --nginx -d ${ url } # -d ${ url2 } 형태로 한 번에 여러 도메인에 대한 인증서 발급
이 명령어를 통해 certbot이 nginx설정을 자동으로 설정해준다.
다시 nginx service 재기동
# reload
systemctl restart nginx.service
자물쇠가 달린 것을 확인할 수 있다~
다만 Let's Encrypt는 90일마다 인증서를 갱신해주어야 하는데, crontab에 내용을 추가해서 자동으로 진행하게 한다.
certbot renew --dry-run
이 명령어로 갱신이 되는지 여부부터 확인한다.
매월 1일에 갱신하고 nginx를 다시 실행할 수 있도록 crontab 설정
# crontab 생성, 수정
crontab -e
0 0 1 * * certbot renew --renew-hook "sudo systemctl restart nginx"
다음달에 모니터링 한다~
'Cloud > Oracle Cloud' 카테고리의 다른 글
[Oracle Cloud] 12. 자율운영 데이터베이스 - jdbc 연결 (0) | 2023.12.15 |
---|---|
[Oracle Cloud] 11. 프리티어 DB (0) | 2022.05.20 |
[Oracle Cloud] 9. 도메인 적용 (0) | 2022.05.16 |
[Oracle Cloud] 8. CentOS 8 타임존 설정 (0) | 2022.05.13 |
[Oracle Cloud] 7. CentOS 8 VM인스턴스 nginx reverse proxy (0) | 2022.05.12 |