- 编译:
- apache一般是把php当做自己的一个模块来启动的.
- 而nginx则是把http请求变量(如get,user_agent等)转发给php进程,即php独立进程,与nginx进行通信. 称为 fastcgi运行方式.
- 为apache所编译的php,是不能用于nginx的.
- 我们编译的PHP 要有如下功能:连接mysql, gd, ttf, 以fpm(fascgi)方式运行
./configure --prefix=/usr/local/fastphp \
--with-mysql=mysqlnd \
--enable-mysqlnd \
--with-gd \
--enable-gd-native-ttf \
--enable-gd-jis-conv
--enable-fpm
- 配置:把请求的信息转发给9000端口的PHP进程, 让PHP进程处理 指定目录下的PHP文件
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}