根据nginx官网的说明:

可以进行如下操作:

编辑并且创建/etc/yum.repos.d/nginx.repo,输入以下内容

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

参考地址:https://www.nginx.com/resources/wiki/start/topics/tutorials/install/

然后直接允许

yum -y install nginx

启动nginx

[root@vcentos-nginx ~]# systemctl start nginx

将nginx 开入到开机启动的服务中去

[root@vcentos-nginx ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@vcentos-nginx ~]#