How to update my Nginx with yum on CentOS 7
Asked Answered
M

1

6

I used yum install nginx on my ECS server, but the version is not high enough to support http2. After googling around, I added a config file:

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

With the content:

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

Then I run yum update nginx, which gave me the version 1.8.1, which is still not high enough to support http2.

Can anyone help me update my nginx to version 1.9.5 or higher, please?

Mysticism answered 9/4, 2016 at 9:30 Comment(0)
G
10

Update your config file to this

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

you need the mainline repository

Glassware answered 9/4, 2016 at 9:42 Comment(3)
What do you type instead of $releasever and $basearch?Catastrophism
@Catastrophism these are handled by Yum to make sure it downloads the correct version for your distribution. So you don't need to replace them. See access.redhat.com/documentation/en-us/red_hat_enterprise_linux/…Glassware
@Glassware after changing the nginx.repo file to that content, with mainline branch, I still get nginx 1.14.1 as the latest nginx on a fresh install of CentOS 8. On another server with the same nginx.repo file, when I do yum list nginx --showduplicates I get all the modern nginx servers including 1.16.1 and 1.18.0. How does that work?Hernandes

© 2022 - 2024 — McMap. All rights reserved.