linux php5.4 nginx配置,linux上安装nginx1.2.3和php5.4.4

linux下安装nginx1.2.3和php5.4.4

安装nginx1.2.3

第一步:解压

[root@test02 software]# tar zxvf nginx-1.2.3.tar.gz

第二步:编译

[root@test02 nginx-1.2.3]# ./configure --prefix=/usr/local/nginx-1.2.3

[root@test02 nginx-1.2.3]# make

[root@test02 nginx-1.2.3]# make install

如果提示缺少pcre库,执行yum install pcre* 来安装pcre 和pcre-devel

第三步:运行

[root@test02 nginx-1.2.3]# cd /usr/local/nginx-1.2.3/

[root@test02 nginx-1.2.3]# ./sbin/nginx &

安装php5.4.4

第一步:解压

[root@test02 software]# tar zxf php-5.4.4.tar.gz

第二步:编译

[root@test02 php-5.4.4]# ./configure --prefix=/usr/local/php-5.4.4 --enable-fpm

[root@test02 php-5.4.4]# make

[root@test02 php-5.4.4]# make install

第三步:复制php.ini

复制php.ini-production 到 /usr/local/php-5.4.4/lib/php.ini

[root@test02 php-5.4.4]# cd /usr/local/php-5.4.4/

[root@test02 php-5.4.4]# cp /opt/software/php-5.4.4/php.ini-production lib/php.ini

修改php-fpm.conf

[root@test02 php-5.4.4]# cd etc/

[root@test02 etc]# mv php-fpm.conf.default php-fpm.conf

找到 ;pm.status_path = /status 去掉前面的分号

新增/home/www目录用于存放php文件

[root@test02 nginx-1.2.3]# mkdir /home/www

[root@test02 nginx-1.2.3]# chown -R nobody:nobody /home/www

修改nginx.conf将php那段改为

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

location ~ \.php$ {

root          /home/www;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  /home/www$fastcgi_script_name;

include        fastcgi_params;

}

location ~ ^/status$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;

include fastcgi_params;

}

location ~ status.html$ {

root /home/www;

}

复制status.html 到 /home/www 目录

[root@test02 php-5.4.4]# cp /opt/software/php-5.4.4/sapi/fpm/status.html /home/www/

运行fpm

[root@test02 php-5.4.4]# ./sbin/php-fpm

新建phpinfo.php 内容为 <?php phpinfo();?>

访问http://192.168.1.107:9090/phpinfo.php

访问http://192.168.1.107:9090/status.html

14215061.jpg

14215062.jpg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值