It was brought to my attention that Nginx finally by-default supports http/2, no longer compiling from source or going dev./beta channels ! Although the most fancy items of http/2 like server side pushes are not included yet, still worth the upgrade.


This is how I activated http/2 on my vps.

First I checked if it was needed to upgrade as I generally have a yum-cron running.

# cat /var/log/yum.log
Apr 16 04:11:30 Updated: selinux-policy-3.7.19-279.el6_7.9.noarch
Apr 16 04:12:18 Updated: selinux-policy-targeted-3.7.19-279.el6_7.9.noarch
Apr 20 03:29:37 Updated: nginx-1.9.15-1.el6.ngx.i386
Apr 23 03:33:24 Updated: tzdata-2016d-1.el6.noarch

Last version was released yesterday : 2016-04-26 nginx-1.10.0, so not yet, lets go ahead and update !

yum update nginx
Loaded plugins: etckeeper, fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
 * base: mirror.nforce.com
 * epel: ftp.nluug.nl
 * extras: mirror.prolocation.net
 * updates: ftp.nluug.nl
 * webtatic: uk.repo.webtatic.com
No Packages marked for Update

Wuuut ! +1 day after release and still not in the repo’s, a well, lets just go ahead and download it straight from nginx.  If you wait a few days this Nginx 1.10.0.1 should be in the repo’s, for now I just went ahead and downloaded & installed it.

wget http://nginx.org/packages/centos/6/i386/RPMS/nginx-1.10.0-1.el6.ngx.i386.rpm

# yum update nginx-1.10.0-1.el6.ngx.i386.rpm
Loaded plugins: etckeeper, fastestmirror
Setting up Update Process
Examining nginx-1.10.0-1.el6.ngx.i386.rpm: nginx-1.10.0-1.el6.ngx.i386
Marking nginx-1.10.0-1.el6.ngx.i386.rpm as an update to nginx-1.9.15-1.el6.ngx.i386
Loading mirror speeds from cached hostfile
 * base: mirror.nforce.com
 * epel: ftp.nluug.nl
 * extras: mirror.prolocation.net
 * updates: ftp.nluug.nl
 * webtatic: uk.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package nginx.i386 0:1.9.15-1.el6.ngx will be updated
---> Package nginx.i386 0:1.10.0-1.el6.ngx will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================
 Package Arch Version Repository Size
=================================================================================================
Updating:
 nginx i386 1.10.0-1.el6.ngx /nginx-1.10.0-1.el6.ngx.i386 2.0 M

Transaction Summary
=================================================================================================
Upgrade 1 Package(s)

Total size: 2.0 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
etckeeper: pre transaction commit
 Updating : nginx-1.10.0-1.el6.ngx.i386 1/2
 Cleanup : nginx-1.9.15-1.el6.ngx.i386 2/2
etckeeper: post transaction commit
 Verifying : nginx-1.10.0-1.el6.ngx.i386 1/2
 Verifying : nginx-1.9.15-1.el6.ngx.i386 2/2

Updated:
 nginx.i386 0:1.10.0-1.el6.ngx

Complete!

Tada :

# nginx -v
nginx version: nginx/1.10.0

Now to activate http/2 :

change

listen 443 ssl;

to

listen 443 ssl http2;

Under the server {}, I restarted the server, but a reload might be enough, also test before applying.

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# service nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]

As to the speed difference, I tried on a single page and did not see any difference, this is not where http/2 will shine on :

HTTP1.1

HTTP/2

I cherry picked the better result on http/2 for people not reading the page 🙂 (I’m assuming some sort of cache was in play)