[root@wg ~]# vi /etc/yum.repos.d/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
[root@wg ~]# yum-config-manager --enable nginx-mainline // 启用主线版 [root@wg ~]# yum makecache // 服务器包信息下载到本地缓存 [root@wg ~]# yum list | grep nginx // 查看可安装版本 [root@wg ~]# yum install -y nginx // 安装、查看安装版本 [root@wg ~]# systemctl stop firewalld [root@wg ~]# nginx -V