centos 安装 nginx +PHP+FastCGI

Centos6.0

yum install php
php -i | grep cgi
有--enable-fastcgi --enable-force-cgi-redirect选项,安装的是php fastcgi版本
按照wiki.nginx上的说明添加yum repo
/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1


yum install nginx

修改/etc/php.ini
cgi.fix_pathinfo=1
重启php-gi,经测试发现对普通的应用无明显影响
注:修改php.ini要重启php-cgi

修改nginx.conf
fastcgi_intercept_errors on;
这个参数对处理错误的php脚本有影响,如果php脚本有错误,该参数为off,访问一个错误的php,返回"HTTP/1.1 500 Internal Server Error" 直接管连接,如果是on,还返回一个不可用的提示

fastcgi_param  SCRIPT_FILENAME  <your-php-script-director>$fastcgi_script_name;

该参数关系到nginx能否正确找到php脚本的位置

测试test.php,放在fastcig_parm SCRIPT_FILENAME参数设置的位置

<?php
phpinfo();
?>

curl "http://localhost/test.php"
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值