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就可以顯示出頁面了。