安装准备
sudo yum install yum-utils
设置yum库
touch /etc/yum.repos.d/nginx.repo
编辑nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
注意:默认情况yum仓库关联的是稳定版的nginx包,如想安装最新版的,要先执行下面命令进行切换
sudo yum-config-manager --enable nginx-mainline
安装
sudo yum install nginx
来源:CSDN
作者:mango_jo
链接:https://blog.csdn.net/mangojo/article/details/104747967