Search code examples
nginxyumhttp2

How to update my Nginx with yum on CentOS 7


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?


Solution

  • 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