502 Error – 502 Bad Gateway

⚠️ What is a 502 Bad Gateway?

It means the web server (nginx) got an invalid response from a backend service — usually PHP-FPM.

Common triggers:

  • PHP-FPM service crashed or hung (server-side)
  • PHP handler is misconfigured
  • PHP version mismatch
  • Invalid rewrite or redirect loop from CMS (e.g., WordPress)
  • Backend is returning a response that nginx doesn’t understand

✅ Step 1: Confirm the Error

  • Open site in incognito/private browser
  • Ask if it affects:
    • Whole site vs. specific pages
    • Multiple domains on same hosting
  • Use httpstatus.io or isup.me

🔎 Step 2: Safe Agent Checks in Plesk

Inside Plesk (for customer’s domain):

  1. Go to Hosting Settings
    • ✅ Switch to a stable PHP version (e.g., 8.1 or 7.4)
    • ✅ Confirm PHP handler is something like FPM application served by nginx
      → If not, try switching from FPM to FastCGI as a test
  2. Check .htaccess file
    • Go to File Manager
    • Rename .htaccess to .htaccess.old
    • Test the site again (if it works now, rewrite rules were broken)
  3. Check Disk Usage (if visible)
    • In Plesk dashboard → Check Resource Usage
    • If disk is full, note it and escalate (don’t delete anything)

📝 Step 3: What to Ask the Customer

Ask:

  • When did the 502 start?
  • Are they using WordPress or another CMS?
  • Have they recently updated the PHP version or installed plugins/themes?
  • Can they still access Plesk dashboard?
  • Is it happening across multiple sites?

🚨 Escalate If:

  • Site is still showing 502 after:
    • PHP version change
    • Handler switch (FPM → FastCGI)
    • .htaccess renamed
  • Multiple domains show 502
  • Customer did not make any changes, and error is sudden
  • Suspected PHP-FPM crash (but no agent access to restart)

📋 Escalation Template (502 Error)

Subject: 502 Error – [Customer Domain]

Customer reports 502 Bad Gateway on: example.com

✅ Confirmed in browser and with httpstatus.io

✅ Site is not suspended

✅ PHP version switched (e.g., from 8.2 to 8.1)

✅ PHP handler changed (FPM → FastCGI)

✅ .htaccess temporarily renamed

❓ CMS in use: WordPress

❓ No recent changes reported

Request Hosting/Infra to check PHP-FPM health or Nginx-PHP connection