📖 ~1 min read
Table of contents
Symptom & Impact
Nginx serves 502 errors for PHP pages, disrupting web application availability.
Environment & Reproduction
Appears after PHP-FPM crashes, socket path changes, or mismatched pool configuration.
Root Cause Analysis
Nginx cannot connect to configured PHP upstream due to process, socket, or permission failure.
Quick Triage
Check php-fpm service health, confirm configured socket path, and inspect recent logs.
Step-by-Step Diagnosis
Review Nginx and PHP-FPM logs, pool settings, and socket permissions for mismatch.

Solution – Primary Fix
Restore PHP-FPM service, align upstream socket configuration, and correct ownership permissions.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Solution – Alternative Approaches
Use TCP upstream endpoint or deploy separate PHP pool for isolated applications.
Verification & Acceptance Criteria
Dynamic pages load normally and upstream connection errors disappear from logs.
Rollback Plan
Revert Nginx and PHP-FPM config changes if new pool setup introduces instability.
Prevention & Hardening
Monitor PHP-FPM pool health and enforce configuration consistency checks.
Related Errors & Cross-Refs
Related to 504 gateway timeout and fastcgi upstream reset errors.
Related tutorial: View the step-by-step tutorial for Ubuntu 16.04 LTS.
View all Ubuntu 16.04 LTS tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Nginx upstream tuning and PHP-FPM pool management documentation.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.