EC2 접속은 OK, ALB 헬스체크 403 오류로 Unhealthy 되는 문제 해결

EC2 접속은 OK, ALB 헬스체크 403 오류로 Unhealthy 되는 문제 해결

EC2 접속은 OK, ALB 헬스체크 403 오류로 Unhealthy 되는 문제를 해결하는 방법에 대해서 정리해 봤습니다.
2026.04.24

안녕하세요 클래스메소드 김재욱(Kim Jaewook) 입니다. 이번 블로그에서는 EC2 접속은 OK, ALB 헬스체크 403 오류로 Unhealthy 되는 문제를 해결하는 방법에 대해서 정리해 봤습니다.

문제 발생

EC2 인스턴스의 IP로 접속을 시도해 보면, [It works!]라고 웹 페이지가 표시되는 것을 확인할 수 있습니다.

image1

하지만 타겟 그룹을 확인하면 [Unhealthy 403]이 표시됩니다.

Unhealthy Health checks failed with these codes: [403]

문제 해결

먼저 원인 특정을 위해 Apache 에러 로그를 확인합니다.

$ sudo tail -f /var/log/httpd/error_log

[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex(index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex(index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex(index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex(index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex(index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
[xxx] [autoindex:error] [pid xxx:tid xxx] [client xxx.xxx.xxx.xxx:xxx] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

ALB 헬스체크 요청을 확인합니다.

$ sudo tail -f /var/log/httpd/access_log

xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - [xxx] "GET / HTTP/1.1" 403 191 "-" "ELB-HealthChecker/2.0"

SELinux를 확인합니다.

$ getenforce

Permissive # Permissive가 출력된다면 OK

Apache 설정을 확인합니다.

$ sudo apachectl configtest

Syntax OK

파일 권한 확인 및 수정을 진행합니다.

$ ls -la /var/www/html/

total 0
drwxr-xr-x. 2 root root  6 Dec  5 21:19 .
drwxr-xr-x. 4 root root 33 Apr 24 03:21 ..

체크리스트는 다음과 같습니다.

순서 확인 항목 명령어
1 에러 로그 확인 sudo tail -f /var/log/httpd/error_log
2 액세스 로그 확인 sudo tail -f /var/log/httpd/access_log
3 Apache 설정 확인 sudo apachectl configtest
4 SELinux 상태 확인 getenforce
5 파일 권한 확인 ls -la /var/www/html/
6 EC2 보안 그룹 확인 AWS 콘솔에서 확인

각 명령어를 입력하면서 확인한 결과, 원인은 /var/www/html/ 디렉토리가 비어있는 것이 원인이며, 즉 index.html 파일이 없기 때문에 Apache가 403을 반환하는 것입니다.

EC2 직접 접속시 It works!가 표시된 이유는 Apache의 기본 Welcome 페이지는 /etc/httpd/conf.d/welcome.conf 에서 표시하기 때문에 EC2 IP로의 직접 접속은 정상처럼 보였던 것입니다.

ALB 헬스체크는 실제 index.html을 요청하기 때문에 파일 없는 현재 상태에서는 403 에러를 발생시킵니다.

이제 index.html 파일을 생성합니다.

# index.html 생성
$ echo "OK" | sudo tee /var/www/html/index.html
$ sudo chmod 644 /var/www/html/index.html

# 파일 확인
$ ls -la /var/www/html/

ALB 헬스체크를 재확인합니다.

$ sudo tail -f /var/log/httpd/access_log

# 403 → 200으로 변경 확인
xxx.xxx.xxx.xxx - - "GET / HTTP/1.1" 200 3 "ELB-HealthChecker/2.0"
xxx.xxx.xxx.xxx - - "GET / HTTP/1.1" 200 3 "ELB-HealthChecker/2.0"

마무리

이번 문제는 EC2 자체의 장애가 아니라, Apache 기본 동작과 ALB 헬스체크 방식의 차이 때문에 발생한 이슈였습니다. EC2에 직접 접속했을 때는 Apache의 기본 Welcome 페이지가 정상적으로 표시되기 때문에 서비스가 정상처럼 보였지만, ALB는 실제로 /var/www/html/index.html에 대한 응답 코드(200)`를 기준으로 헬스 상태를 판단하기 때문에 문제가 드러난 케이스였습니다.

결과적으로 /var/www/html/ 디렉토리에 index.html 파일이 존재하지 않아 Apache가 403을 반환했고, 이로 인해 ALB Target Group이 Unhealthy 상태로 전환되었습니다. 이후 index.html 파일을 생성하면서 정상적으로 200 OK 응답이 반환되었고, 헬스체크 역시 정상 상태로 복구되었습니다.

이번 사례를 통해 확인할 수 있었던 핵심 포인트는 다음과 같습니다.

  • EC2 접속 정상 여부와 ALB 헬스체크 정상 여부는 동일하지 않다
  • ALB는 실제 HTTP 응답 코드(특히 200)를 기준으로 상태를 판단한다
  • Apache 기본 페이지와 실제 서비스 파일(index.html)은 별개로 동작할 수 있다
  • 403 에러는 권한 문제뿐만 아니라 DirectoryIndex 부재로도 발생할 수 있다

특히 운영 환경에서는 EC2에 직접 접속했을 때 정상으로 보인다고 해서 문제가 없다고 판단하기보다는, 반드시 ALB 헬스체크 기준 응답이 무엇인지까지 함께 확인하는 것이 중요합니다.

이 글이 동일하게 EC2는 정상인데 ALB만 Unhealthy 상태가 발생하는 문제를 겪는 분들께 도움이 되었으면 합니다.

この記事をシェアする

関連記事