Web Hosting & Dev How to Fix 502 Bad Gateway and 504 Timeout on Nginx and Cloudflare Step-by-step commands to fix 502 Bad Gateway and 504 Gateway Time-out on Nginx, PHP-FPM, Node.js, and Cloudflare with fastcgi_read_timeout and pool tuning.