ELB health check fails if path is anything but root

0

I've got an Application ELB running in front of a Target Group that currently has only 1 instance, a web server (NGINX) running a WordPress site.

The ELB's health check fails with a 404 error unless I set the path to the web server's root directory ("/"). The ELB seems to be directing traffic fine--I can browse anywhere on the site no problem, including to a special file I created just for the health check (health-check.php).

I looked in my web server's access log to see what exactly is happening when the ELB health check tries to ping a file:

172.31.36.39 - - [12/Jul/2020:13:38:41 +0000] "GET /health-check.php HTTP/1.1" 404 134 "-" "ELB-HealthChecker/2.0"

But if I point the health checker to the root it works fine:

172.31.28.14 - - [12/Jul/2020:13:59:42 +0000] "GET / HTTP/1.1" 200 396 "-" "ELB-HealthChecker/2.0"

I'm going round and round in circles here trying to figure this out but can't seem to pinpoint the problem.

Any advice or help would be hugely appreciated.

Why does the server return a 404 code to the health checker but returns a 200 when I access the same exact file with my browser?

질문됨 4년 전4165회 조회
2개 답변
0

I resolved this: the health checker apparently communicates to the server without using the domain name assigned to it and I had inadvertently left something in the NGINX config. that pointed any requests other than those with the domain name to a different root location. So the health checker wasn't actually looking in the right root directory. My mistake.

답변함 4년 전
0

I figured it out...see my last post.

답변함 3년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠