- 论坛徽章:
- 11
|
环 境: rhel4.7(内核 2.6.9-78.EL)
相关软件包: nginx-0.8.8.tar.gz
php-5.2.8.tar.gz
php-5.2.8-fpm-0.5.10.diff.gz
pcre-devel-4.5-4.el4_6.6.rpm (安装nginx的依赖包)
1.php-fpm的安装
# gunzip php-5.2.8.tar.gz | tar xvf - (解压包php-5.2.8,将生成目录php-5.2.8)
# gunzip php-5.2.8-fpm-0.5.10.diff.gz (解压包php-5.2.8-fpm-0.5.10.diff)
# patch -d php-5.2.8 -p1 nobody
Unix group of processes
nobody
启动php-fpm
# /usr/local/php/sbin/php-fpm start
2.nginx的安装
# gunzip nginx-0.8.8.tar.gz | tar xvf - (解压缩包nginx-0.8.8,生成目录nginx-0.8.8)
# cd nginx-0.8.8
# ./configure \
--prefix=/usr/local/nginx (指定--prefix.配置前,需要先安装pcre-devel)
# make (编译)
# make install (编译安装)
配置nginx
修改/usr/local/nginx/conf/nginx.conf 配置文件,需做如下修改
user nobody nobody; (首行user去掉注释,并与php-fpm.conf中的user,group配置同)
server {
listen 8080; (修改所使用的端口)
server_name localhost; (修改所使用的服务器名)
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
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;
}
(取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,$fastcgi_script_name 应改为$document_root$fastcgi_script_name,或者使用绝对路径)
完成配置后启动
# /usr/local/nginx/sbin/nginx
编写个phpinfo.php文件保存在/usr/local/nginx/html/目录下,文件内容如下
可通过 http://127.0.0.1:8080/phpinfo.php 访问到php信息页,表明安装成功.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/28641/showart_2026144.html |
|