[英]PHP application behind application load balancer failing health check
I am trying to deploy a PHP through AWS CodeDeploy and am currently stuck on the AllowTraffic step in CodeDeploy.我正在尝试通过 AWS CodeDeploy 部署 PHP,目前卡在 CodeDeploy 中的 AllowTraffic 步骤。 The application is on an EC2 instance behind an ALB.
该应用程序位于 ALB 后面的 EC2 实例上。 In the ALB, I am getting failing health checks.
在 ALB 中,我的健康检查失败了。 I have the PHP application code sitting in the following directory on the EC2 instance:
/var/www/html/src
.我的 PHP 应用程序代码位于 EC2 实例的以下目录中:
/var/www/html/src
。 If I were to curl the private IP of the EC2 following by the directory where the code sits, I am getting an error 404 Not Found.如果我是 curl EC2 的私有 IP,后面是代码所在的目录,我会收到错误 404 Not Found。 Even though the
index.php
file is in that directory, I am unable to curl it.即使
index.php
文件在该目录中,我也无法 curl 它。 Currently I have security groups setup where the ALB security group allows any traffic from only HTTP, and all traffic from the ALB security group is allowed to reach the EC2 instance.目前我有安全组设置,其中 ALB 安全组仅允许来自 HTTP 的任何流量,并且允许来自 ALB 安全组的所有流量到达 EC2 实例。 I am able to curl the root of the instance and see Apache's default page.
我能够访问实例的根目录 curl 并查看 Apache 的默认页面。
If I were to adjust the health check settings on the ALB Target group, I get a 403 error when setting the health check to /
.如果我要调整 ALB 目标组的健康检查设置,我会在将健康检查设置为
/
时收到 403 错误。 I get a 404 error when specifying the path to the directory that has the PHP application code.指定具有 PHP 应用程序代码的目录的路径时出现 404 错误。
Any advice on how I can get the instance to a healthy state for the ALB would be appreciated.任何有关如何将实例转移到 ALB 的健康 state 的建议都将不胜感激。
Application Load balancer security group allows traffic on port 80 EC2 instance security group allows traffic from Application Load Balancer security group.应用程序负载均衡器安全组允许端口 80 上的流量 EC2 实例安全组允许来自应用程序负载均衡器安全组的流量。
The PHP application should be accessible on port 80, where Apache is running. PHP 应用程序应该可以在端口 80 上访问,其中 Apache 正在运行。 The Application Load Balancer has only 1 listener that is set up for port 80, that forwards traffic to the target group.
Application Load Balancer 只有 1 个为端口 80 设置的侦听器,用于将流量转发到目标组。
The heath check path in your TG should be URL path, not the actual location on the EB instance. TG 中的健康检查路径应该是 URL 路径,而不是 EB 实例上的实际位置。 You can try with just
/index.php
:您可以尝试使用
/index.php
:
/index.php
This assumes that your application is actually working and the only issue are health checks.这假设您的应用程序确实在运行,唯一的问题是健康检查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.