1.安装PHP,如下两条安装命令:
yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装PHP扩展包:
普通安装:
yum -y install PHP72w PHP72w-cli PHP72w-fpm PHP72w-common PHP72w-devel
较全面安装:
yum -y install PHP72w PHP72w-cli PHP72w-fpm PHP72w-common PHP72w-devel PHP72w-embedded PHP72w-gd PHP72w-mbstring PHP72w-MysqLnd PHP72w-opcache PHP72w-pdo PHP72w-xm
查看版本:PHP -v
2.在Nginx配置集成PHP
编辑Nginx.conf添加如下配置server块:
server
{
Listen 192.168.241.15:80;
server_name 192.168.241.15;
access_log /home/logs/serverPHP.access.log combined;
location /
{
index index.PHP index.HTML index.htm;
}
location ~ \.PHP$
{
root /home/server15;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_filename $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
3.重启Nginx和启动PHP-fpm fastcgi:
/usr/Nginx/sbin/Nginx
PHP-fpm -D
在/home/server15目录新建index.PHP文件就可以测试了:
http://192.168.241.15/index.PHP
以上是内存溢出为你收集整理的nginx探索(6)搭建nginx+php环境(centos7环境下)全部内容,希望文章能够帮你解决nginx探索(6)搭建nginx+php环境(centos7环境下)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)