Nginx FastCGI PHP-FPM Socket Checklist

halfbrain_logo512adminJune 19, 2026
4 lượt xem

Nginx FastCGI PHP-FPM Socket Checklist

Nginx sends PHP requests to PHP-FPM using FastCGI. The connection usually uses a Unix socket or TCP address. If the Nginx fastcgi_pass value does not match the PHP-FPM listen value, PHP pages fail.

Core principle

Nginx and PHP-FPM must agree on the handoff point. Nginx fastcgi_pass points to where PHP-FPM is listening.

Checklist

  1. Find fastcgi_pass in Nginx config.
  2. Find listen value in PHP-FPM pool config.
  3. Compare socket path or TCP address.
  4. Check whether socket file exists.
  5. Check socket ownership and permission.
  6. Check PHP-FPM service status.
  7. Check Nginx error log for upstream errors.
  8. Check PHP-FPM config syntax.
  9. Restart PHP-FPM if socket is missing.
  10. Reload Nginx after config validation.

Reusable lesson

This applies to 502 errors, PHP version upgrades, WordPress migration, Nginx server block setup and multi-PHP environments.

Checklist Type Troubleshooting
Level Intermediate
Risk Level High Risk
Estimated Time 30–75 minutes

When to Use This Checklist

Use this checklist when PHP pages return 502, download as files or fail after PHP-FPM version change or Nginx config edits.

Required Tools

SSH access, Nginx config, PHP-FPM pool config, error logs, service status, nginx -t

Before You Start

Do not restart services blindly. First compare Nginx fastcgi_pass with PHP-FPM listen value.

Structured Checklist Steps

  1. Find fastcgi_pass.
  2. Find pool listen value.
  3. Compare handoff target.
  4. Check socket file.
  5. Check socket permissions.
  6. Check PHP-FPM status.
  7. Read Nginx error log.
  8. Test PHP-FPM config.
  9. Restart PHP-FPM if needed.
  10. Reload Nginx safely.

Rollback Plan

If a socket change breaks PHP, restore the previous Nginx or PHP-FPM pool config and restart only the affected PHP-FPM version.

Common Mistakes

  • Wrong PHP version socket.
  • Socket path typo.
  • PHP-FPM stopped.
  • Permission mismatch.
  • Reloading Nginx without testing config.

Related Commands

grep -R "fastcgi_pass" /etc/nginx/sites-enabled/
grep -R "listen =" /etc/php/*/fpm/pool.d/
ls -la /run/php/
sudo systemctl status php8.2-fpm
sudo nginx -t
sudo tail -n 100 /var/log/nginx/error.log

Share:

Disclaimer: The guides, checklists, commands, and examples on HalfBrain.net are provided for educational and operational reference only. Server environments, hosting providers, software versions, security settings, and WordPress configurations can vary, so you should always review commands before running them on your own system. We do our best to keep the content accurate and useful, but we cannot guarantee that every command, configuration, or recommendation will fit every environment. Always back up your website, database, and server configuration before making changes. HalfBrain.net is not responsible for data loss, downtime, security incidents, misconfiguration, or other issues that may result from applying the information on this website. Use the material at your own discretion.

Leave a Reply

Your email address will not be published. Required fields are marked *