1.默认 yum 仓库无法直接安装nginx,需要创建一个文件 /etc/yum.repos.d/nginx.repo,并将下面的内容复制进去:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
2.编辑并保存/etc/yum.repos.d/nginx.repo文件后,在命令行下执行
[root@localhost ~]# yum list | grep nginx nginx.x86_64 1.8.0-1.el6.ngx nginx nginx-debug.x86_64 1.8.0-1.el6.ngx nginx nginx-debuginfo.x86_64 1.8.0-1.el6.ngx nginx nginx-nr-agent.noarch 2.0.0-8.el6.ngx nginx
3.安装
yum -y install nginx