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/php/php5.6-fpm.sock; # 注意着里sock文件的位置(在/var/run下找到对应的sock文件)
fastcgi_index index.php;
include fastcgi_params;
}
yuan@lnmp:/var/run/php$ ll
php5.6-fpm.sock //找到这个文件的位置,填在下面图片标注中
最后一步重启 nginx服务
sudo service nginx restart
Nginx关联php配置文件
Nginx常用配置