1、请创建 /etc/yum.repos.d/nginx.repo 包含以下内容的文件:
[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
2、使用yum安装nginx
sudo yum-config-manager --enable nginx-mainline
sudo yum install nginx