SSL은 선택이 아니라 기본이다
HTTPS 없이 서비스하면 사용자 데이터가 평문으로 전송되고, 구글 검색 순위도 내려간다. 크롬은 HTTP 사이트에 "안전하지 않음" 경고를 표시한다. 더 이상 "비용 문제"를 이유로 HTTPS를 미룰 수 없다.
Let's Encrypt는 무료 SSL 인증서를 발급해준다. 유효기간 90일이지만 Certbot이 자동 갱신을 처리한다.
Certbot 설치 및 인증서 발급 (Ubuntu + Nginx 기준)
1단계: Certbot 설치
sudo apt update
sudo apt install certbot python3-certbot-nginx -y
2단계: 인증서 발급
# 도메인에 자동으로 Nginx 설정까지 변경
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
# 웹서버 없이 standalone 모드 (포트 80 일시 해제)
sudo certbot certonly --standalone -d yourdomain.com
3단계: 자동 갱신 설정 확인
# certbot은 설치 시 cron job 또는 systemd timer를 자동 등록
sudo systemctl status certbot.timer
# 갱신 테스트 (실제 갱신 없이 시뮬레이션)
sudo certbot renew --dry-run
Nginx 수동 설정이 필요한 경우
server {
listen 80;
server_name yourdomain.com;
return 301 https://$host$request_uri; # HTTP → HTTPS 강제 리다이렉트
}
server {
listen 443 ssl http2;
server_name yourdomain.com;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
# Let's Encrypt 권장 설정 포함
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# HSTS 추가 (한번 설정하면 되돌리기 어려우니 max-age 짧게 시작)
add_header Strict-Transport-Security "max-age=86400" always;
}
Cloudflare를 쓰는 경우
Cloudflare를 DNS로 사용한다면 SSL/TLS 탭에서 "Full (strict)"를 선택하면 자동으로 HTTPS가 적용된다. 단, 오리진 서버에도 인증서가 필요하므로 Cloudflare Origin Certificate를 발급받아 설치해야 한다.
SSL 설정 후 실제로 HTTPS가 제대로 동작하는지, HSTS 헤더가 포함되는지 CodeScan으로 확인해보는 걸 권장한다.