How to install latest official Nginx on Centos 8 / RHEL 8, instead using Nginx from Centos 8 or RHEL 8 repository.
Currently Centos / RHEL 8 repo using too old version of Nginx 1.14.1.
If you already install Nginx 1.14.1 remove it first
# dnf remove nginx
First install dnf-utils
# dnf install dnf-utils
Create file in /etc/yum.repos.d/nginx.repo and paste code below
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:
sudo yum-config-manager --enable nginx-mainline
If you running on production server, choose Nginx stable version.
To install nginx, run the following command:
# dnf install nginx
When prompted to accept the GPG key, accept it.
Enable Nginx start up and start Nginx.
# systemctl enable nginx
# systemctl start nginx
View Comments (4)
THANK YOU !
good guide ;)
Your welcome. Thank You for visiting ServerDiary
Will DNF install a newer version of Nginx than the crappy Yum did? (1.14.1)? Which version of PHP and PHP-FPM will we install?
I am genuinely grateful to the holder of this site who has shared this fantastic post at at this place.