查看有无可用yum源
# yum list nginx
Available Packages
nginx.x86_64 1:1.10.2-1.el7 epel
系统自带的nginx yum源版本为1.10,不用
手动添加yum源
# vim /etc/yum.repos.d/nginx.repo
------------------------------------------
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
------------------------------------------
此时查看可用nginx版本
# yum list nginx
Available Packages
nginx.x86_64 1:1.12.1-1.el7.ngx nginx
ok
安装nginx
# yum -y install nginx
启动nginx
# systemctl start nginx.service