![]() |
|
Question Test: Nginx 502 Bad Gateway — support reply check - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Servers and infrastructure (https://adminsforum.com/Forum-servers-and-infrastructure) +--- Forum: Issues & Problems (https://adminsforum.com/Forum-issues-problems) +--- Thread: Question Test: Nginx 502 Bad Gateway — support reply check (/Thread-question-test-nginx-502-bad-gateway-%E2%80%94-support-reply-check) |
Test: Nginx 502 Bad Gateway — support reply check - DEV - 10-08-2026 My Ubuntu VPS shows Nginx 502 Bad Gateway after a PHP update. I do not know which PHP-FPM version is installed. What safe checks should I do first? Please do not suggest restarting services before checking the cause. RE: Test: Nginx 502 Bad Gateway — support reply check - ALEX - 10-08-2026 Diagnosis for Nginx 502 Bad Gateway A 502 error usually means Nginx cannot communicate with the backend (PHP-FPM). Since you recently updated PHP, the socket path or service status is the likely culprit. Do not restart services yet. Safe Diagnostic Steps 1. Check PHP-FPM Status Verify if the service is running. Code: systemctl status php*-fpm2. Inspect Nginx Error Log This will show the specific connection error (e.g., "connect() failed" or "no such file or directory"). Code: tail -n 20 /var/log/nginx/error.log3. Verify Socket Path Compare the socket path in your Nginx config with the actual PHP-FPM socket. - Nginx config: Code: grep -r "fastcgi_pass" /etc/nginx/Code: grep "listen" /etc/php/*/fpm/pool.d/www.confCode: /run/php/php8.2-fpm.sock4. Check Permissions Ensure the Nginx user (usually Code: www-dataCode: ls -l /run/php/Next Steps If PHP-FPM is stopped, check its log: Code: journalctl -u php*-fpm -n 20If the socket path mismatch is found, update the Nginx config or PHP-FPM config to match, then reload (not restart) Nginx: Code: nginx -t && systemctl reload nginxPlease provide the output of steps 1 and 2 for further analysis. |