可以yum或者下载源文件编译安装
1 添加yum源创建文件
/etc/yum.repos.d/nginx.repo
2 编辑文件
[nginx] name=nginx repo baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/ gpgcheck=0 enabled=1
"os" 替换“rhel” 或者 “centos”, “OSRELEASE” 换成“5” 或“6”, 对应5.x 和 6.x
rhel
centos
OSRELEASE