CGI,
通用网关接口,用于WEB服务器和应用程序间的交互,定义输入输出规范,每收到一个请求都需要创建一个进程去处理。
FastCGI
用来提高 cgi 程序性能,启动一个master,再启动多个 worker,不需要每次解析 php.ini。
php-fpm
实现了 FastCGI 协议,是 FastCGI 的进程管理器,支持平滑重启,可以启动的时候预先生成多个进程。
Nginx
实现了多种协议的web服务器,在配置文件nginx.conf
location ~ .*\.php$ {
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param PHP_VALUE "nbs.agent_enabled=false";
#include fcgi.conf;
include fastcgi.conf;
}
与fastcgi_pass 定义的ip和端口 使用fastcgi协议与 php-fpm 进行通信。