SSL이란 옛 이름을 가진 TLS은 보안 통신 프로토콜이다. SSL은 현재는 사용되지 않으며 모두 폐기되었다.
지금 SSL이라고 불리는 인증 프로토콜들은 모두 TSL일것이다.
나는 여태 도메인을 구매하고 http 주소를 사용하고 있었다. 이유는 보안 인증을 위해 돈이 나갈것 같았고, 다른일을 하느라 검색해보지 않았다.
오늘 짬이나서 AWS Certificate Manager가 무료라는 것을 확인하고 도입하려 한다.
그런데 AWS에서 지원하는 Certificate Manager는 API Gateway를 사용하거나 LB를 사용해야한다... 나는 아직 서버비용을 절감하고자 밤마다 서버를 종료한다. 때문에 해당 선택지는 올바르지 않다고 판단하여 지금 사용하고있는 Nginx에서 처리를 하려고한다.
절차는 아래와 같다.
- EC2에 Nginx 설치 (이미 진행)
sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
- Certbot 설치 (Let's Encrypt 클라이언트)
Certbot / Let's Encrypt는 TLS 인증서를 무료로 발급해주는 도구 및 기관이다.
sudo apt install certbot python3-certbot-nginx -y
- Let's Encrypt 인증서 발급
sudo certbot --nginx
위 과정을 진행을 잘 했다면 아래와 같은 메시지를 볼 수 있다.
Congratulations! You have successfully enabled https://example.com
nginx 설정 파일을 확인해본다면
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
location / {
proxy_pass http://localhost:3000; # 예: Node.js 앱
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
위와같은 예제로 설정되어있을것이다.
또한 인증서는 90일짜리기 때문에 crontab명령어를 통해 주기적으로 갱신 시켜줘야 한다.
sudo certbot renew --dry-run
sudo crontab -e
0 2 * * * /usr/bin/certbot renew --quiet
이후
sudo systemctl reload nginx
nginx 갱신 명령어를 실행시켜주면 적용되는것을 확인할 수 있다.

'Web' 카테고리의 다른 글
| AWS EC2 -> 온프레미스 전환 (2) - 포트포워딩 (0) | 2025.04.11 |
|---|---|
| AWS EC2 -> 온프레미스 전환 (1) - Window Terminal + WSL + Ubuntu (0) | 2025.04.11 |
| 브랜치 전략 (0) | 2025.04.08 |
| Nextjs + GitHub Actions 으로 CI/CD 적용하기 (0) | 2025.04.07 |
| Route 53 적용하기 (0) | 2025.04.06 |