Update Nginx to latest official Version in Centos 8/el8/CWP
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 :
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
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.