Although the otherwise-posted advice regarding manually setting the $releasever
and $basearch
values in the repo file will not hurt per se (at least while you stick to the software release referred to by the values you set), it is not strictly necessary.
I also have the exact contents you have posted, in a file named /etc/yum.repos.d/nginx.repo
which functions correctly without having set the above values explicitly.
My advice would be to perform a yum update
prior to attempting to install (as it's possible that when you tried to install, yum had not queried all of the repo URLs from the files in /etc/yum.repos.d/
for the latest versions of their databases). Also make absolutely sure that your created file ends in .repo
as otherwise it will be ignored by yum.
Failing that, check the SElinux security contexts on the files in that directory - or just go ahead and manually restore them by running restorecon -Rv '/etc/yum.repos.d'
and check the file permissions on the manually created repo file(s), which should be owned by root:root and have show 644 as file permissions. To manually amend these, run chmod 644 /etc/yum.repos.d/nginx.repo
and chown root:root /etc/yum.repos.d/nginx.repo
I hope that some part of the above resolves your issues!