로컬 환경에서 HTTPS 도메인 및 SSL 인증서 확인하는 방법
실제 DNS를 변경하지 않고도 로컬 서버에서 특정 도메인에 대한 HTTPS 연결 및 SSL 인증서 상태를 확인하는 방법입니다.
curl –resolve 옵션으로 HTTPS 요청 테스트
curl --resolve 옵션은 특정 도메인을 임의의 IP로 강제 매핑하여 요청을 보낼 수 있게 해줍니다. 이는 /etc/hosts를 수정하지 않고 테스트할 수 있다는 장점이 있습니다.
기본 사용법
curl --resolve blog.scbyun.com:443:127.0.0.1 -I https://blog.scbyun.com/HTTP/2 200
date: Mon, 12 Jan 2026 12:55:06 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
...옵션 설명
- –resolve : 도메인:포트:IP 강제 매핑
- -I : HTTP 헤더만 출력 (HEAD 요청)
openssl s_client로 SSL 인증서 상세 확인
openssl s_client 명령어를 사용하면 서버에서 제공하는 SSL 인증서 정보를 직접 확인할 수 있습니다.
인증서 정보 확인 명령어
openssl s_client \
-connect 127.0.0.1:443 \
-servername blog.scbyun.com \
</dev/null 2>/dev/null | \
openssl x509 -noout -subject -issuer -datessubject=CN=blog.scbyun.com
issuer=C=US, O=Let's Encrypt, CN=R3
notBefore=Sep 10 00:00:00 2025 GMT
notAfter=Dec 09 23:59:59 2025 GMT옵션 설명
- -connect : 실제 연결할 IP:PORT
- -servername : SNI에 전달할 도메인
- openssl x509 : 인증서 정보 출력
참고URL
- ubuntu manuals : noble curl
- ubuntu manuals : noble openssl