进入目录/etc/nginx/sites-available
sudo vim default
把以下代码端前的#去掉
location ~ .PHP$ {
# fastcgi_split_path_info ^(.+.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
然后很关键的一点就是重启系统!是的,你没有看错,就是要重启系统,即便restart nginx也不好使。