When I write this post, the latest Nginx version is 220.127.116.11 on Ubuntu that still doesn’t support HTTP/2.0. The nginx version that supports HTTP/2.0 starts from version 1.9.5.
So if we want to enable HTTP/2.0 on our Nginx, we need to upgrade or install to correct version.
echo “deb http://nginx.org/packages/mainline/ubuntu/ `lsb_release -cs` nginx” >> /etc/apt/sources.list
echo “deb-src http://nginx.org/packages/mainline/ubuntu/ `lsb_release -cs` nginx” >> /etc/apt/sources.list
Run those commands above to add the PPA to update our Ubuntu Repository that include Nginx mainline release (mainline release is not same as stable release and provides latest “development” version)
curl http://nginx.org/keys/nginx_signing.key | apt-key add –
sudo apt-get update
Then you can install nginx:
sudo apt-get install nginx
or in case you are upgrading:
Note: In case you get error message like this:
dpkg: error processing archive /var/cache/apt/archives/….
trying to overwrite ‘/etc/default/nginx’, which is also in package nginx-common …
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
You need to remove the current nginx-common, and you can do that by this command:
sudo apt-get remove nginx-common