参考:
http://nginx.org/en/linux_packages.html
http://www.cnblogs.com/hitwtx/archive/2012/02/13/2349742.html
https://blog.csdn.net/lnboxue/article/details/74783885
首先,你需要知道你的centos发行版本: cat /etc/redhat-release
我的是6
用root权限在你的linux上执行: vi /etc/yum.repos.d/nginx.repo
写入
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
baseurl=http://nginx.org/packages/centos/6/$basearch/
centos是你的系统版本,red hat的话用rhel。
6 是发行版本,当前貌似只有6和7。
接下来,就可以执行 yum install nginx