Upgrade to latest nginx on CentOS 7

The nginx version that is shipped with CentOS epel repository is quite old.

To upgrade your nginx installation you need to create a repository and add nginx servers to it.

to do so create a file called nginx.repo on /etc/yum.repos.d/nginx.repo and place following content in 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

[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

then simply stop nginx service and run the yum update command.

systemctl stop nginx
yum update nginx

this will be using the latest stable package. if you want to use the latest mainline release you need to tell yum to use that one instead by running:

sudo yum-config-manager --enable nginx-mainline

Incoming search terms:

  • upgrade nginx yum
  • musclep8z

Leave a comment

Leave a Reply