Cause:
Nginx is located in the third-party yum source, not in the centos official yum source.
Solution:
Install epel (Extra Packages for Enterprise Linux)
A. Go to epel website http://fedoraproject.org/wiki/epelto download
B. My system is centos5.7, cpu is x86_64, so I downloaded wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
For centos6, you should download the wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
C. Install epel
Rpm-ivh epel-release-5-4.noarch.rpm
If you execute yum install nginx again, the system prompts that the installation is successful.
Note:
Epel installation is related to centos system version and cpu hardware architecture,
View the system version (lsb-release-),
View cpu hardware architecture (arch)
Epel is a RHEL Ora software repository that provides high-quality software packages for RHEL and its derivative releases, such as CentOS and Scientific Linux. With EPEL installed, you can install the software through yum install package-name, just like on Fedora.