Lets Encrypt 설치시 에러 Some challenges have failed. The Certificate Authority failed

Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet
Lets Encrypt 설치하는데 이 에러 메시지가 뜬다면 Let's Encrypt 인증서 발급 시 사용되는 HTTP-01 챌린지 방식에서 문제가 발생했음을 의미. Certbot이 인증을 위해 생성한 임시 파일을 CA(인증기관)가 다운로드하지 못했다는 뜻.
🔍 원인 요약
Certbot은 도메인의 소유권을 증명하기 위해 웹 서버의 특정 위치(.well-known/acme-challenge
)에 임시 파일을 생성합니다.
→ 인증기관(예: Let's Encrypt)은 인터넷을 통해 그 URL로 접근해 파일을 확인하려고 합니다.
→ 그런데 그 파일에 접근이 불가능하면 "failed to download the temporary challenge files" 오류가 발생합니다.
✅ 해결 방법 체크리스트
-
--webroot-path 지정 정확성 확인
-
Certbot 명령어에서
--webroot-path
또는-w
옵션으로 지정한 경로가 웹 서버가 실제로 사용하는 루트 디렉터리와 일치하는지 확인하세요. -
예시:
sudo certbot certonly --webroot -w /var/www/html -d example.com
-
/var/www/html/.well-known/acme-challenge/testfile
경로에 파일을 생성했을 때, 브라우저에서http://example.com/.well-known/acme-challenge/testfile
로 접근이 되는지 테스트해보세요.
-
-
방화벽, 보안 설정 확인
-
외부에서 HTTP(포트 80) 접근이 차단되어 있다면 인증기관이 확인할 수 없습니다.
-
-
웹 서버 설정 확인 (Apache, Nginx 등)
-
.well-known/acme-challenge
경로에 접근할 수 없게 설정되어 있는 경우 (예: 인증 필요, 리다이렉션 등) 문제 발생. -
예시 (Nginx 설정):
location ^~ /.well-known/acme-challenge/ { root /var/www/html; allow all; }
-
-
서버가 실제로 도메인을 서빙하고 있는지 확인
-
DNS가 올바르게 설정되어 있고, 요청한 도메인이 현재 서버의 IP로 연결되는지 확인하세요.
-
dig
,nslookup
,curl http://example.com/.well-known/acme-challenge/testfile
등을 활용.
-
-
HTTPS 강제 리다이렉션 문제
-
일부 서버에서는 HTTP 요청을 HTTPS로 리다이렉트하도록 되어 있어서, 인증기관이
HTTP
로 확인하려다 실패할 수 있습니다.
-
📌 테스트 팁
# 테스트용 파일 생성
mkdir -p /var/www/html/.well-known/acme-challenge
echo "test" > /var/www/html/.well-known/acme-challenge/testfile
# 브라우저나 curl로 확인
curl http://example.com/.well-known/acme-challenge/testfile
# 결과: "test" 가 출력되어야 정상
안된 이유 - DNS에서 도메인을 현재 VPS 아이피로 연결하지 않아서 그랬음