728x90
이 가이드는 Rocky Linux에서 Let's Encrypt를 이용해 upself.tistory.com 도메인에 SSL/TLS 인증서를 발급하고 설정하는 방법을 설명합니다.
1. Certbot 설치 준비
Certbot을 설치하기 전에 EPEL 저장소를 활성화해야 합니다.
EPEL 저장소란? EPEL(Extra Packages for Enterprise Linux)은 RHEL 계열 배포판에서 사용할 수 있는 추가 패키지 저장소입니다. Certbot과 같은 필수 도구를 설치할 때 필요합니다.
# EPEL 저장소 활성화
sudo dnf install epel-release -y
# Certbot 설치 (NGINX 플러그인 포함)
sudo dnf install certbot python3-certbot-nginx -y
# Apache를 사용할 경우
sudo dnf install certbot python3-certbot-apache -y
2. 단일 도메인에 SSL 인증서 적용
단일 도메인(upself.tistory.com)에 인증서를 설정하려면 Certbot을 사용합니다.
2.1 Certbot으로 인증서 발급
NGINX 환경:
sudo certbot --nginx -d upself.tistory.com
Apache 환경:
sudo certbot --apache -d upself.tistory.com
2.2 인증서 상태 확인
발급된 인증서 정보를 확인합니다.
sudo certbot certificates
출력 예시:
Certificate Name: upself.tistory.com
Domains: upself.tistory.com
Expiry Date: 2024-08-01 14:03:11+00:00 (VALID: 89 days)
3. 다중 도메인(SAN 인증서) 설정
여러 서브도메인에 대한 인증서를 발급하려면 **SAN (Subject Alternative Name)** 인증서를 사용합니다.
3.1 다중 도메인 인증서 발급
NGINX 환경:
sudo certbot --nginx -d upself.tistory.com -d www.upself.tistory.com -d blog.upself.tistory.com
Apache 환경:
sudo certbot --apache -d upself.tistory.com -d www.upself.tistory.com -d blog.upself.tistory.com
3.2 인증서 상태 확인
발급된 인증서에 포함된 도메인 목록을 확인합니다.
sudo certbot certificates
출력 예시:
Certificate Name: upself.tistory.com
Domains: upself.tistory.com, www.upself.tistory.com, blog.upself.tistory.com
Expiry Date: 2024-08-01 14:03:11+00:00 (VALID: 89 days)
4. 웹 서버 설정 예시
발급된 인증서를 웹 서버에 설정합니다.
4.1 NGINX 설정
server {
listen 443 ssl;
server_name upself.tistory.com www.upself.tistory.com blog.upself.tistory.com;
ssl_certificate /etc/letsencrypt/live/upself.tistory.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/upself.tistory.com/privkey.pem;
location / {
root /var/www/html;
index index.html;
}
}
4.2 Apache 설정
<VirtualHost *:443>
ServerName upself.tistory.com
ServerAlias www.upself.tistory.com blog.upself.tistory.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/upself.tistory.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/upself.tistory.com/privkey.pem
DocumentRoot /var/www/html
</VirtualHost>
5. 자동 갱신 설정
Let's Encrypt 인증서는 90일간 유효합니다. 자동 갱신을 설정해야 만료를 방지할 수 있습니다.
5.1 갱신 테스트
sudo certbot renew --dry-run
5.2 자동 갱신 Cron 설정
수동으로 Cron 작업을 추가하려면:
sudo crontab -e
추가:
0 3 * * * /usr/bin/certbot renew --quiet && systemctl restart nginx
설명: 매일 새벽 3시에 인증서를 갱신하고 NGINX를 재시작합니다.
마무리
이제 Rocky Linux에서 upself.tistory.com에 대한 단일 도메인 SSL 인증서와 다중 도메인(SAN 인증서)을 설정하고 관리하는 방법을 배웠습니다.
Tip: 발급 후 웹 서버를 반드시 재시작하여 인증서를 적용하세요!
반응형
'운영체제 및 플랫폼 > Linux(리눅스)' 카테고리의 다른 글
Rocky Linux에서 SVN(Subversion) 설정 가이드 (0) | 2024.12.21 |
---|---|
[Elastic] ELK 스택 설치 및 설정 가이드 (0) | 2024.07.08 |
Rocky Linux Download 및 Setting (0) | 2024.02.26 |
[Error] 'telnet'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는배치 파일이 아닙니다. (0) | 2024.02.01 |
Linux에서 HP서버 조회하기 (1) | 2023.11.29 |