1、安装php,使用yum安装就行
2、安装php-fpm
3、找到 php.ini文件,修改为cgi.fix_pathinfo=0,如果前面有分号请去掉,那是注释
4、找到 xxx/php-fpm.d/www.conf文件,修改user =xxx
group = xxx, xxx代表你安装的web服务器,nginx或者 apche或者其他
5、找nginx.conf文件
添加下列内容
location ~\.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
6、重启nginx,php-fpm
7、可以在根目录/usr/share/nginx/html放置一个phpinfo.php文件,文件内容为
8、根目录可以自定义。
9、输入你的ip/phpinfo.php,能打开一个页面就是成功了。
原文:https://www.cnblogs.com/hello147/p/12299649.html