转载
原文地址:http://www.nowamagic.net/academy/detail/1226239
安装 PHP-FPM
1. 开始安装 Nginx 和 PHP-FPM 之前,你可能需要卸载系统中以前安装的 Apache 和 PHP。
| 3 | yum removehttpd* php* #这个命令是删除不干净的 | 
 
| 4 | yum removephp-cli php-common php   #删除 | 
 
 
 
重新安装 PHP:
| 1 | yum --skip-broken install php53 | 
 
 
 
2. CentOS 6.2/6.1/6/5.8 下安装Remi源:
| 1 | ## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ##  | 
 
| 4 | ## CentOS 5 and Red Hat (RHEL) 5 ##   | 
 
 
 
3. 安装 PHP-FPM:
| 1 | yum --enablerepo=remi,remi-test install nginx php php-fpm php-common | 
 
| 3 | yum --enablerepo=remi install php53 php-fpm | 
 
 
 
4. 安装完毕之后启动 PHP-FPM:
| 1 | /etc/init.d/php-fpm start  | 
 
 
 
5. 设置Nginx & PHP-FPM开机自启动:
| 2 | chkconfig --levels 235 nginx on  | 
 
| 3 | chkconfig --add php-fpm  | 
 
| 4 | chkconfig --levels 235 php-fpm on | 
 
 
 
配置 Nginx
Nginx 的配置很简单:
| 4 |    fastcgi_pass   127.0.0.1:9000;  | 
 
| 5 |    fastcgi_index  index.php;  | 
 
| 6 |    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;  | 
 
| 7 |    include        fastcgi_params;  | 
 
 
 
OK,重启 Nginx 完成配置: