Update Nginx to latest official Version in Centos 8/el8/CWP

by Sandeep B.

Today we’re going to update nginx in centos 8 which by default installs an old version of nginx webserver and I’m on the way of finding an answer why devs did that. If you check the nginx version you’ll see nginx 1.14.1 or other old version is installed at the time of writing this topic :

[root@CentOS-82-64-minimal scripts]# yum list nginx
Last metadata expiration check: 0:01:18 ago on Tue 20 Oct 2020 06:26:38 PM CEST.
Installed Packages
nginx.x86_64                    1:1.14.1-9.module_el8.0.0+184+e34fea82                    @AppStream
[root@CentOS-82-64-minimal scripts]# nginx -v
nginx version: nginx/1.14.1

So we’ll going to update it today and disable this old version of nginx.

Step 1

Disable old version and uninstalling it :

dnf module disable nginx php
dnf remove nginx*

Step 2

Adding Nginx Stable official repo :

*you can add mainline repo too but not recommended in production environment

edit /etc/yum.repos.d/nginx.repo and remove any content there follow this commands one by one :

> /etc/yum.repos.d/nginx.repo
nano /etc/yum.repos.d/nginx.repo

then add this content and save it :

name=nginx repo

Step 3

Install nginx :

yum install nginx

thats it you installed the latest version of nginx chekc via this command :

nginx -V

CWP Users :

Extra tips for CWP user after installing nginx rebuild webserver config and you’re done.

If this post helps you in any way please consider a donation

Donate with PayPal :


You may also like


Jonas December 2, 2020 - 12:03 am

I followed the steps and all works without any errors thank you Sandeep

JM April 7, 2021 - 11:41 am

Is valid this for centOS7?

Sandeep B. April 7, 2021 - 1:08 pm

step 2 and 3 is valid for centos 7

Anand May 26, 2021 - 11:17 am

I have installed nginx pagespeed as per your other artile.

Buy I get the error

nginx: [emerg] module “/etc/nginx/modules/ngx_pagespeed.so” version 1020000 instead of 1020001 in /etc/nginx/nginx.conf:1

Sandeep B. May 26, 2021 - 12:13 pm

module updated


Leave a Comment