nginx中fastcgi_pass(转发到php解释器php-fpm) Posted on 2026-02-13 Views: nginx处理请求index.php过程123456789URL ↓Nginx location 匹配 ↓root / alias ↓fastcgi_param SCRIPT_FILENAME ↓php-fpm 执行 2.php典型 Nginx 配置123456789101112server { listen 80; server_name example.com; root /var/www/public; location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/run/php-fpm/www.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }} 请求: 1/hello.php Nginx 计算出: 12$document_root = /var/www/public$fastcgi_script_name = /hello.php 最终传给 php-fpm: 1/var/www/public/hello.php