PHP7.1.6總體參考php
https://www.zhihu.com/question/50615606/answer/145699091html
http://www.bubuko.com/infodetail-2128641.html nginx
3.rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpmcentos
4.yum install nginxphp-fpm
service nginx start3d
5.htm
# find / -name nginx.confblog
/etc/nginx/nginx.confip
在nginx.conf中最後一行看到io
include /etc/nginx/conf.d/*.conf;
因此找到/etc/nginx/conf.d/default.conf;
在location下面加上同級
location ~ \.php$ {
root /var/www/html; #指定php的根目錄
fastcgi_pass 127.0.0.1:9000;#php-fpm的默認端口是9000
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
6.nginx -t若是沒有報錯,報錯去修改錯誤
7./usr/sbin/nginx -s reload 重啓nginx服務
而後在/var/www/html創建index.php
<?php
phpinfo();
8.檢查發現php-fpm沒有監聽
發現老是沒法解析,因此要配置php-fpm
9./opt/runtime/php/sbin/php-fpm
10.找到php-fpm.conf.default改爲php-fpm.fonf
11.將www.conf.defualt改爲www.conf
12.啓動php-fpm
/opt/runtime/php/sbin/php-fpm
13.查看php-fpm是否打開
netstat -npa | grep 9000
14.在nginx指向文件寫下index.php /var/www/html/index.php
<?php
phpinfo();