Affected versions: Debian 13 (Trixie)

πŸ“– ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

Symptom & Impact

Web applications return 502 errors for dynamic PHP content.

Environment & Reproduction

Appears after PHP-FPM pool or nginx user/group changes.

Root Cause Analysis

Nginx cannot read/write the configured PHP-FPM Unix socket due to permission mismatch.

Quick Triage

Confirm configured socket path and access rights.

Step-by-Step Diagnosis

Correlate nginx error log and PHP-FPM pool startup details.

Illustrative mockup for debian-13 β€” nginx_502_socket
Nginx cannot access PHP-FPM socket β€” Illustrative mockup β€” Progressive Robot

Solution – Primary Fix

Align nginx and PHP-FPM socket ownership/mode, then restart services.

Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Illustrative mockup for debian-13 β€” nginx_200_php
PHP requests served successfully β€” Illustrative mockup β€” Progressive Robot

Solution – Alternative Approaches

Use TCP upstream for FPM if socket permission management is problematic.

Verification & Acceptance Criteria

PHP pages return HTTP 200 and no new 502 errors are logged.

Rollback Plan

Restore previous FPM pool config if app behavior regresses.

Prevention & Hardening

Track web stack config drift and test after PHP package updates.

connect() to unix:/run/php/php-fpm.sock failed (13: Permission denied).

Related tutorial: View the step-by-step tutorial for Debian 13.

View all Debian 13 tutorials on the Tutorials Hub β†’

Browse all common problems & solutions on the Tutorials Hub.

References & Further Reading

Nginx FastCGI and Debian PHP-FPM pool configuration docs.

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.