Nginx PHP 返回200,但是空白页
ngxin;php-fpm安装后【ān zhuāng hòu】,html静态页🤺面没问【miàn méi wèn】🏅题【tí】,但是phpinfo页面虽🥑然返回200,但总是空白页
也没有【yě méi yǒu】🖇任何报🕞错,考虑应【kǎo lǜ yīng】📉该是【gāi shì】nginx已经将🍎php页面转【yè miàn zhuǎn】移给php处理了,所以问题应该【tí yīng gāi】🤣在php的配置上,经过查找【zhǎo】,发现需要在nginx中加入🍾一句话
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
安装完【ān zhuāng wán】💺nginx后默认【hòu mò rèn】的【de】fastcgi_params配置文🎥件中没⌚有上面这句话。
在【zài】nginx.conf中的【zhōng de】
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;
}
或者在【huò zhě zài】🤲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;
然后重【rán hòu chóng】启🕝nginx就可以🚗显示出页面了。
关键词:Nginx,PHP
阅读本文后您有什么感想? 已有 人给出评价!
- 0
- 0
- 0
- 0
- 0
- 0