ALB 502 Bad Gateway on Plesk: A Real-World Incident Investigation Guide
How we diagnosed an intermittent AWS Application Load Balancer failure in an Ubuntu, Plesk, Nginx, Apache, PHP-FPM and WordPress environment.
Introduction
Application Load Balancer errors are confusing because a simple 502 Bad Gateway can originate from AWS ALB, Security Groups, Network ACLs, Plesk, Nginx, Apache, PHP-FPM, WordPress, Fail2Ban, iptables or ModSecurity.
This guide explains a practical investigation flow for identifying where the failure actually happens, without exposing any client name, domain, IP address or production infrastructure details.
Environment
Server Stack
Ubuntu Server, Plesk Obsidian, Nginx, Apache, PHP-FPM, WordPress
AWS Stack
AWS EC2, Application Load Balancer, Target Groups, Security Groups, ENI
High-Level Architecture
The Problem
Users started seeing a public website error:
However, the Plesk panel was still accessible through an SSH tunnel:
This immediately raised an important question: was the issue really with Plesk, or somewhere between AWS ALB and the server?
Step 1: Verify Core Services
First, check whether Nginx, Apache and PHP-FPM are running.
In Plesk environments, PHP-FPM may appear as a Plesk-specific service, for example:
Restart the web stack if needed:
Step 2: Repair Plesk Web Configuration
If Plesk updates were stuck or web configuration appears inconsistent, run:
This checks and repairs Apache configuration, Nginx configuration, SSL assignments, PHP handlers and domain-level web configuration.
Step 3: Check Server Logs
Check domain-level logs:
Also check the global Nginx error log:
Step 4: Test the Public Website
Run a header test against the public website:
If the output shows:
Then the error is generated by AWS ALB, not directly by Plesk or WordPress.
Step 5: Bypass the Load Balancer
Test the backend server directly using the private IP and Host header.
If the backend responds with 200 OK, it proves that Nginx, Apache, PHP-FPM and WordPress are working behind the load balancer.
Step 6: Check Whether ALB Requests Reach Plesk
Watch the domain access logs while refreshing the public website.
If the public website still shows 502 but no new log entry appears, it means the request is not reaching Plesk. The issue is likely at ALB, Target Group, Security Group, ENI, NACL or firewall level.
Step 7: Create a Static Health Check File
Do not use the WordPress homepage as the ALB health check. It may redirect, load plugins, hit the database or trigger security rules.
Test it:
Expected result:
Recommended ALB Health Check
Use a static health file instead of WordPress homepage.
Step 8: AWS Target Group Investigation
In AWS, check:
Target Registration
Confirm that the correct EC2 instance or private IP is registered on the correct port.
Health Check
Confirm protocol, port, path and success codes.
Security Group
EC2 must allow HTTP/HTTPS traffic from the ALB Security Group.
Listener Rules
Confirm that the ALB listener forwards to the correct target group.
Step 9: Understand 502 vs 503
| Error | Meaning | Common Cause |
|---|---|---|
| 502 Bad Gateway | ALB tried to reach the target but connection or response failed. | Wrong protocol, port, TLS issue, backend closed connection. |
| 503 Service Unavailable | ALB has no healthy target available. | Target removed, target unhealthy, listener has no healthy backend. |
Step 10: Check Fail2Ban and iptables
If the target becomes healthy and then unhealthy again after a few minutes, investigate dynamic blocking tools such as Fail2Ban and iptables.
Fail2Ban is not part of WordPress. It is a Linux/Plesk security service that monitors logs and creates firewall rules through iptables.
Step 11: Why Increased Traffic Can Trigger the Issue
Increased traffic alone does not normally break ALB. However, it can increase bot traffic, crawler activity, failed login attempts and security events.
Root Cause Analysis Framework
| Check | Result | Interpretation |
|---|---|---|
| Plesk Panel | Working | Plesk service is healthy. |
| Direct backend curl | 200 OK | Nginx, Apache, PHP-FPM and WordPress are responding. |
| Public URL | 502 / 503 | Failure is likely before or inside ALB routing. |
| Plesk access logs | No new request | ALB request is not reaching the backend server. |
| Target Group | Unhealthy | Check health reason, Security Group, ENI, NACL and iptables. |
Important AWS Checks
- Target health reason: Check whether it says timeout, response code mismatch or failed health checks.
- Target port: Confirm whether target is registered on port 80 or 443.
- Protocol mismatch: Do not send HTTP traffic to HTTPS port or HTTPS traffic to HTTP port.
- Security Group: EC2 must allow inbound traffic from the ALB Security Group.
- ENI: Confirm the correct network interface and private IP are attached to the instance.
Recommended Stable Architecture
For most WordPress/Plesk websites behind ALB, the safest setup is:
This avoids backend TLS handshake issues between ALB and Plesk.
Final Checklist
Server
- Nginx running
- Apache running
- PHP-FPM running
- Plesk repair completed
- Backend curl returns 200
AWS
- Target registered correctly
- Health check uses /health.html
- Security Group allows ALB
- Listener forwards to correct target group
- Target status is healthy
Conclusion
A 502 Bad Gateway does not always mean WordPress or Plesk is down. In this investigation, the backend was proven healthy through direct private IP testing, while public traffic failed at the AWS ALB layer.
The correct troubleshooting approach is to isolate every layer: public domain, ALB, target group, security groups, ENI, firewall rules, Nginx, Apache, PHP-FPM and WordPress.
The biggest lesson: always create a static health check endpoint and monitor Fail2Ban/iptables when using Plesk behind AWS ALB.




