Create a file named
vi /etc/yum.repos.d/nginx.repo that contains the following contents:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/ gpgcheck=0 enabled=1 |
Alter the file, replacing OS at the end of the URL with rhel or cen tos, depending on your distribution. Replace OSRELEASE with 6 or 7 for version 6.x or 7.x, respectively. Then, run the following commands:
yum -y install nginx systemctl start nginx firewall-cmd --permanent --zone=public --add-port=80/tcp firewall-cmd --reload |