nginx在解析php会出现no put file specified ,也就是找不到php文件
解决方法:
1、/etc/php5/cgi/php.ini
/etc/php5/fpm/php.ini
修改php.ini文件中cgi.fix_pathinfo=1
2、修改nginx.conf 文件
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:8000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name; //给出文件的真实路径
include fastcgi_params;
}
3、启动
spawn-fcgi -a 127.0.0.1 -p 8000 -C 10 -u nobody -f /usr/bin/php-cgi
/etc/init.d/php5-fpm start
/etc/inti.d/nginx start
同时验证上一篇博文配置反向代理:
test.php
<?php
var_dump($_SERVER['SERVER_ADDR']);
?>
http://192.168.88.136:8080/test.php
136访问时,打印结果为:string(14) "192.168.88.134"
此时说明192.168.88.136是一个代理