首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

centos 装配 nginx +PHP+FastCGI

2012-07-01 
centos 安装 nginx +PHP+FastCGICentos6.0yum install phpphp -i | grep cgi有--enable-fastcgi --enable-

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 repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=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参数设置的位置
<?phpphpinfo();?>

curl "http://localhost/test.php"

热点排行