rpm -ivh http://mirror.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rhel7.noarch.rpm
vi /etc/yum.repos.d/city-fan.org.repo
enabled的值0改成1,如下
[cityfan]
name=cityfan
baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/
# Centos7系统用 baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/
enabled=1
gpgcheck=0
yum upgrade libcurl
***注意:如果升级时提示Requires: libnghttp2.so.14()(64bit)错误时,可以使用安装epel源来解决,安装方法如下:
yum install epel-release -y
然后继续执行上面命令
测试:
curl --http2 -I https://nghttp2.org/
others
=================================
参考
yum升级curl支持http2测试
https://www.cnblogs.com/lazyfang/p/8040493.html
Centos7 yum安装LNMP
https://www.cnblogs.com/ivy-zheng/p/10987431.html
centos7下使用yum方式安装PHP7
https://www.cnblogs.com/pandawan/p/11100311.html
[关闭防火墙]
# 临时
systemctl stop firewalld
# 永久
systemctl disable firewalld
[nginx]
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx
service nginx start
测试:
curl http://localhost
nginx位置:/etc/nginx/
www默认位置:/usr/share/nginx/html
如果有php,要先启动php-fpm:(见下节)
systemctl start php-fpm
重启: service nginx restart
[php]
使用以下命令将yum仓库包升级更换成PHP7的rpm包
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
先使用yum命令安装基本PHP组件,以后要用到啥再安装啥
yum -y install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
再安装PHP-fpm(进程管理器,提供PHP进程管理方式,可以有效控制内存和进程、平滑重载PHP配置)
yum -y install php70w-fpm php70w-opcache
安装完之后启动php-fpm
systemctl start php-fpm
查看版本以检测是否安装成功
php -v
检测PHP是否能与Nginx互通
1.在Nginx的默认HTML文件夹里(/usr/local/webserver/nginx/html/)新建一个index.php,内容如下:
<?php
phpinfo();
?>
2.修改Nginx的配置文件(可使用find /|grep nginx.conf搜索配置文件位置)Nginx.conf,修改新增如下:
复制代码
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
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_params;
}