nginx

Install the latest version of Nginx on CentOS 6 and CentOS 7 using Yum

I noticed that on my CentOS 6 box, I was still running nginx 1.0.15. I wanted to upgrade to nginx 1.10.1. However, when I ran sudo yum update nginx, it showed that there were no Packages marked for Update.

Luckily, getting the latest version through Yum is straight-forward and only requires adding a new repo. First, create a new file, nginx.repo, in the yum repo directory.

$ vim /etc/yum.repos.d/nginx.repo

Next, give it the following contents:

[nginx] 
name=nginx repo  
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/  
gpgcheck=0  
enabled=1  

Save the file, then shut down the nginx service (unnecessary if nginx wasn't on the system previously)

$ sudo service nginx stop  

Now, run the yum update command again (or install if nginx wasn't on the system previously)

$ sudo yum update nginx

It should now let you update to the latest version! As soon as you install the new version, start nginx back up.

$ sudo service nginx start

more Nginx posts

more yum posts

more CentOS posts