1. 下载nginx源码
编译
测试运行是否正常
2. 下载php源码
编译,测试是否能用
3. nginx通过fast-cgi转发请求给php的php-fpm进程进行处理
所以确保1)编译nginx时候,fast-cgi启用
2)编译php的时候php-fpm启用
没有启用则重新编译
4. 配置nginx.conf
location ~ \.php$ {
root html; // 根路径
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000; // 转发端口
fastcgi_index index.php;
}
php-fpm的conf中要监听:127.0.0.1:
listen = 127.0.0.1:9000
5. 运行测试