Rocky Linux 9 - Nginx Let’s Encrypt 인증서 SSL 적용

Certbot 설치

$ sudo dnf install epel-release

$ sudo dnf update

$ sudo dnf install certbot python3-certbot-nginx

 

Nginx 설정

$ sudo vi /etc/nginx/conf.d/example.com
...
server_name example.com www.example.com;
...

 

Nginx 재시작

$ sudo nginx -t

$sudo systemctl reload nginx

 

Certbot 인증서 적용

sudo certbot --nginx -d example.com -d www.example.com

 

Certbot 인증서 갱신

sudo certbot renew --dry-run

 

Certbot 인증서 자동 갱신(한번만)

# 서비스 등록
$ sudo systemctl enable certbot-renewal.timer

# 서비스 시작
$ sudo systemctl start certbot-renewal.timer

# 서비스 상태 확인
$ systemctl status certbot-renewal.timer

 

Certbot 설치된 인증서 보기

$ sudo certbot certificates