• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Ubuntu 14.04 Nginx HTTP/2 Directive, NPN & ALPN

By Abhishek Ghosh August 23, 2016 12:22 am Updated on August 23, 2016

Ubuntu 14.04 Nginx HTTP/2 Directive, NPN & ALPN

Advertisement

Previously, we wrote how to upgrade Ubuntu 14.04 LTS running Nginx to support HTTP/2 avoiding recompilation or actual stopping the server. Here is a Handy Guide For the New Users Around Ubuntu 14.04 Nginx HTTP/2 Directive, NPN & ALPN. Sadly, HTTP/2 is Not Exactly Easy Like SPDY. The reasons are obvious – SPDY, as well QUIC, HTTP/1.1 is within HTTP/2. Sadly, what we have not said in that easy upgrading of Nginx guide is about NPN & ALPN. Let us handle one by one.

 

Ubuntu 14.04 Nginx HTTP/2 Directive

 

That means, what you’ll add in /etc/nginx/sites-enabled/default file. First you will have these things :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
         http2_max_concurrent_streams 128;   #default
         http2_max_concurrent_streams 64;
         http2_streams_index_size     32;    #default
         http2_streams_index_size     64;    #default
         http2_idle_timeout           30s;   #default
         http2_recv_timeout           3m;    #default
         http2_chunk_size             200k;
         http2_max_field_size         4096;  #default
         http2_max_header_size        16384; #default
         http2_pool_size              8192;
...

Which we have not changed are marked as #default. Official documentation is here :

Advertisement

---

Vim
1
https://nginx.org/en/docs/http/ngx_http_v2_module.html

You need to add this directive too :

Vim
1
add_header Alternate-Protocol 443:npn-http/2;

With older HTTP/1.1 and SPDY, we used this :

Vim
1
add_header Alternate-Protocol 443:npn-http/2;

Add it higher (I mean to cover all location directives), otherwise it is not impossible some browser may miss the header advertisement for a particular content type. Alternate-Protocol is used by servers to tell the clients where they can connect directly with the given protocol. For example an HTTP/1.1 server could reply with Alternate-Protocol: 9999:h2 to tell the client to connect to a different port (9999), knowing that behind that port there is a HTTP/2 server. Without this header, a client would not know what protocol to speak on port 9999.

 

Testing Ubuntu 14.04 Nginx HTTP/2 With Google Chrome Browser

 

Now, you need to test whether things are working or not. Open Google Chrome browser. Now load your website’s any webpage. Open Developer Tool, select Network. Right click on the waterfall (click where Method, Status etc written) to evoke an option menu and click to add Protocol column. Now click Disable Cache option and reload the webpage. If you used our guide how to quickly upgrade Ubuntu 14.04 LTS running Nginx to support HTTP/2 or similar method, then protocol will be HTTP/1.1. We can understand your sadness – Google Chrome browser is not counting as HTTP/2.

Ubuntu 14.04 Nginx HTTP-2 Directive NPN ALPN

Now, test on SSL Labs. You’ll see that, ALPN shown as no, NPN shown as yes. Your server supports HTTP/2, but is not ALPN capable. For an ALPN capable server, Alternate-Protocol is just informative. Before May 31st, 2016 a protocol named NPN (Next Protocol Negotiation) was used. That was not a very efficient protocol, but it did the job. There is a newer negotiation protocol called ALPN (Application-Layer Protocol Negotiation). This is a more efficient version with more future-oriented features. Obviously, switching from NPN to ALPN there are far more benefits. However, web servers that in turn need at least OpenSSL 1.0.2 to run HTTP/2 with ALPN. That thing is very difficult to bring on Ubuntu 14.04. Google Chrome discontinued supporting NPN. Run nginx -V to see the OpenSSL is of 2014. With Ubuntu 16.04 LTS, you’ll by default get HTTP/2 with ALPN. It does not mean that you can not force Ubuntu 14.04 LTS to get HTTP/2 with ALPN. Most users were using old versions of Ubuntu, PHP 7 is not always a choice for all web servers (which is default for Ubuntu 16.04 LTS). In previous guide we helped you to upgrade to HTTP/2 in easy way. Unless you are upgrading step by step, for running website it is risky to jump to newest, specially with self managed servers.

.fail domain costs huge. Marketing can make anything king. It is not that Google Chrome would break if continued to support NPN. Invariably either you need to upgrade that Nginx or upgrade your Ubuntu/Debian/CentOS. Obviously, many users will think about first option. We will suggest so too in case PHP application demands work to support PHP 7.

 

How to Make Ubuntu 14.04 Nginx HTTP/2 Working With ALPN?

 

Frankly either you need to compile yourself or use someone’s compiled version. We are suggesting to follow CloudFlare’s way – compile Nginx from source supporting both SPDY and HTTP/2.

Vim
1
https://blog.cloudflare.com/open-sourcing-our-nginx-http-2-spdy-code/

You may find compiled version of Nginx by someone on GitHub with that patch. We will release our compiled tested version for Ubuntu 16.04 LTS, because it will be meaningless for us to work with older version. With these information, you are up to date to August 2016 around the basics.

Tagged With ubuntu maximum concurrent streams
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Ubuntu 14.04 Nginx HTTP/2 Directive, NPN & ALPN

  • Install Nginx HTTP/2 With ALPN on Ubuntu 14.04 From ondrej/nginx PPA

    In our previous guide, we have shown how to easily upgrade Nginx on Ubuntu 14.04 for HTTP/2 support. The required changes in the /etc/nginx/sites-enabled/default file, /etc/nginx/nginx.conf file and limitations of that way of installation has been discussed on this article. In this guide, we will show how to install Nginx HTTP/2 with ALPN on Ubuntu […]

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

  • Optimizing Nginx HTTP/2 TLS : Basic Principles

    We hope that most of the readers are using latest version of deb GNU/Linux (like Ubuntu 16.04 LTS) or latest CentOS which fully supports HTTP/2. In case you are using Ubuntu 14.04 or older Ubuntu, please read our old guide to upgrade your server to make compatible with HTTP/2. This Article on Optimizing Nginx HTTP/2 TLS […]

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Market Segmentation in BriefSeptember 20, 2023
  • What is Booting?September 18, 2023
  • What is ncurses?September 16, 2023
  • What is JTAG in Electronics?September 15, 2023
  • iPhone 15 Pro Max Vs Samsung Galaxy S22/S23 UltraSeptember 14, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy