Zaher Ghaibeh
PHP Backend developer
I've experience in a few PHP Frameworks, such as Laravel, Lumen and Slim (The last two are used for building Microservices/API services).
Installing nginx 1.10 with HTTP/2 support
Published at Wednesday, May 4, 2016 , Categorized under: Linux, Nginx

In the past few days nginx stable version has reached the version 1.10 with HTTP/2 support.

I have blogged before about how to install nginx on ubuntu 14.4 but using ppa:nginx/stable  channel , sadly the channel was not updated yet to have the latest version, so here is how to install the latest version.

1- If you have nginx installed before using ppa:nginx/stable you should uninstall it using the command

sudo apt-get remove nginx

this will remove nginx but will keep the configuration files

2- You should add the official apt repo to sources.list file or you can add it to sources.list.d directory like this

$ sudo -s

# nano /etc/apt/sources.list.d/nginx-stable.list

Add the following line

deb http://nginx.org/packages/ubuntu/ trusty nginx

save the file and exit.

3- We should download the key for nginx

$ wget -c http://nginx.org/packages/keys/nginx_signing.key

4- we should import the key

$ cat nginx_signing.key | sudo apt-key add -

5- Optional : delete the key

$ rm -f nginx_signing

6- update and install nginx

$ sudo apt-get update && sudo apt-get install -y nginx

7- Enable HTTP/2 : just a small note before you enable HTTP/2 support, that it will not work under normal port 80 as its only supported over SSL , so in your Server block you should add the following :

server {

    listen 443 ssl http2 default_server;
    listen :::443 http2 default_server;

// everything else goes here 

}

and remember to restart your nginx.

PS: as usual, since english is not my mother language, you might find some errors, so if you do let me know and I will be happy to fix it.