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 :

yum module disable nginx
yum 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 :

[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

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 :

md-donate

You may also like

1 comment

Jonas December 2, 2020 - 12:03 am

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

Reply

Leave a Comment