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 年前檢視次數 4168 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南