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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ