DB / Nginx/Apache/Load Balancer / 503
CRITICAL
Nginx/Apache/Load Balancer Service Unavailable
The HTTP 503 status code indicates the web server is operational but cannot handle the request, typically due to an overloaded or temporarily unavailable backend service.
Common Causes
- The upstream application server (e.g., PHP-FPM, Gunicorn, Node.js) is down or not responding.
- The server is overloaded, hitting resource limits (CPU, memory, connections).
- A load balancer's health check is failing, marking backend instances as unhealthy.
- Maintenance mode is active or a service is intentionally stopped.
How to Fix
1 Check Upstream Application Status
Verify if your application process (e.g., PHP-FPM, Gunicorn) is running and listening on the correct port.
BASH
$ sudo systemctl status php8.1-fpm
# Or check for a listening port
sudo ss -tlnp | grep :9000 2 Review Web Server Error Logs
Examine the web server (Nginx/Apache) error logs for specific upstream failure messages.
BASH
$ sudo tail -f /var/log/nginx/error.log
# For Apache
sudo tail -f /var/log/apache2/error.log 3 Increase Proxy Timeouts and Connection Limits
If the backend is slow, increase Nginx proxy timeout settings to prevent premature 503 errors.
BASH
$ # In your Nginx location block
location / {
proxy_pass http://backend;
proxy_connect_timeout 60s;
proxy_read_timeout 60s;
proxy_send_timeout 60s;
} 4 Verify Load Balancer Health Checks
Ensure your load balancer (AWS ALB, Nginx upstream) can reach the backend health check endpoint.
BASH
$ # Example curl to test health endpoint from the server
curl -f http://localhost:8080/health