How to install latest official Nginx on Centos 8 / RHEL 8

Install latest official Nginx on Centos 8 / RHEL 8Install

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

ServerDiary

ServerDiary

5 thoughts on “How to install latest official Nginx on Centos 8 / RHEL 8

  1. 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?

  2. I am genuinely grateful to the holder of this site who has shared this fantastic post at at this place.

  3. Aw, this was an incredibly nice post. Finding the time
    and actual effort to generate a really good article… but what can I
    say… I hesitate a lot and never seem to get anything done.

Leave a Reply

Your email address will not be published. Required fields are marked *