Chinaunix首页 | 论坛 | 博客
  • 博客访问: 170795
  • 博文数量: 49
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 337
  • 用 户 组: 普通用户
  • 注册时间: 2013-02-23 15:51
文章分类

全部博文(49)

文章存档

2014年(23)

2013年(26)

我的朋友

分类: 系统运维

2013-04-22 22:28:30

ngxin中安装php-fpm后,html静态页面没问题,不过,虽然phpinfo页面返回200状态码,但浏览却总是空白页,也没有任何报错。

考虑应该是nginx已经将php页面转移给php处理了,所以问题应该在php的配置上,经过查找,发现需要在nginx中加入一句话:
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

安装完nginx后,默认的fastcgi_params配置文件中没有上面这句。

在nginx.conf中的
 

复制代码 代码如下:
location ~ .php$ {
  root           html;
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include        fastcgi_params;
}
 

或在fastcgi_params配置文件中加入:
 

复制代码 代码如下:
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

重启nginx,即可正常显示页面了。

您可能感兴趣的文章:


阅读(3458) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~