标签:网上 为什么 comm var efault odi rip location index
1.由于我也不知道为什么,在网上找了很多资料,nginx要和php-fpm结合,所以在使用nginx配置之前要安装php-fpm
2.yum install php70w-fpm,service php-fpm start
使用yum install php-fpm会报错
Error: php70w-common conflicts with php-common-5.4.16-42.el7.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
3.rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
4.yum install nginx
service nginx start
5.
# find / -name nginx.conf
/etc/nginx/nginx.conf
在nginx.conf中最后一行看到
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();
可以看到
centos7 安装LNMP(php7)之 nginx php-fpm yum安装以及配置文件修改
标签:网上 为什么 comm var efault odi rip location index
原文地址:http://www.cnblogs.com/zhouqi666/p/6793731.html