版本 | 安装路径 | |
nginx | nginx/1.9.2 | /usr/local/nginx |
php | 7.2.4 | /usr/local/php |
nginx.conf文件在/usr/local/nginx/conf
http {
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保持默认状态
/usr/local/php/sbin/php-fpm
/usr/local/nginx/sbin/nginx
编写php文件-index.php
echo “hello world.”;
curl访问or浏览器访问
访问http://192.168.0.200:81/index.php
Nginx查看nginx.conf配置文件
加载nginx的fast-cgi模块
php-fpm 监听127.0.0.1:9000
php-fpm 接收到请求,启用worker进程处理请求
php-fpm 处理完请求,返回给nginx
nginx将结果通过http返回给浏览器



