include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 81;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/php/$fastcgi_script_name; #当要求资源是php后缀的文件时,在目录/data/php中查找
include fastcgi_params;
}
}
}
php-fpm保持默认状态3、运行3.1、启动php-fpm
/usr/local/php/sbin/php-fpm3.2、启动nginx
/usr/local/nginx/sbin/nginx3.3、浏览器访问
编写php文件-index.php<?php
echo \公众hello world.\公众;
curl访问or浏览器访问4、流程4.1、流程图
4.2、笔墨描述如下
访问http://192.168.0.200:81/index.phpNginx查看nginx.conf配置文件加载nginx的fast-cgi模块php-fpm 监听127.0.0.1:9000php-fpm 吸收到要求,启用worker进程处理要求php-fpm 处理完要求,返回给nginxnginx将结果通过http返回给浏览器