Categories: LinuxWeb Server

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

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

Related Post
[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

Recent Posts

Auto renew Let’s Encrypt SSL Certificate using Systemd and restart Nginx / Apache if success

On other post, we create an article how to obtain Let's Encrypt SSL Certificate on…

3 weeks ago

How to obtain Let’s Encrypt SSL Certificate for Apache or Nginx using Certbot

Now SSL is one of SEO (Search Engine Optimization) signal. Read it on Google Webmaster…

3 weeks ago

How to check UDP connection on Linux using Conntrack

This linux command line to check UDP connection on Linux using Conntrack command. # conntrack…

4 months ago

How to auto sync modified file to another server using Lsyncd on Centos 7

Lsyncd watches a local directory trees event monitor interface (inotify or fsevents). It aggregates and…

4 months ago

CSF Error: *WARNING* Binary location for [HOST] [/usr/bin/host] in /etc/csf/csf.conf is either incorrect, is not installed or is not executable

If you have error warning on CSF (ConfigServer Security & Firewall) on Linux servers when…

5 months ago

How to SELinux allow Apache or PHP-FPM connect remote MySQL

If you have trouble apache or PHP-FPM can not connect to remote MySQSL server, example…

6 months ago