How to Enable HTTP/2 in Nginx with the Early Alpha Patch – Step‑by‑Step Guide

This guide explains how to apply Nginx's early‑alpha HTTP/2 patch, covering required source versions, OpenSSL/LibreSSL preparation, patch application, configuration flags, compilation, and enabling HTTP/2 in the server block, while noting the patch's production limitations.

21CTO
21CTO
21CTO
How to Enable HTTP/2 in Nginx with the Early Alpha Patch – Step‑by‑Step Guide

In a previous article the author mentioned that Nginx would not support HTTP/2 until the end of the year, so they used the H2O web server to provide HTTP/2 services.

In early August, Nginx announced an early‑alpha patch for HTTP/2, introducing the http_v2_module. The official notes state that the patch is strongly discouraged for production, does not support Server Push, and replaces the previous SPDY module, making SPDY configuration impossible after applying the patch.

To enable HTTP/2 with the patch, you need Nginx version 1.9.0 or newer (the example uses 1.9.3). Download the latest Nginx source package and the latest OpenSSL or LibreSSL source, then extract both.

Apply the patch:

cd nginx-1.9.3 wget http://nginx.org/patches/http2/patch.http2.txt patch -p1 < patch.http2.txt

Configure Nginx with at least the http_v2_module and http_ssl_module:

./configure --with-openssl=../libressl-2.2.2 --with-http_v2_module --with-http_ssl_module

Run make and make install. In the Nginx configuration, enable HTTP/2 for a site by adding http2 to the listen directive, for example:

listen 443 ssl http2 fastopen=3 reuseport;

Other configuration details are the same as previous articles; note that HTTP/2 does not use gzip for header compression, so the former spdy_headers_comp directive is no longer needed.

After a day of testing, the author found the patch to be reasonably stable for personal use and will update the article if any issues arise.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ConfigurationHTTP2NGINXWeb serverpatchSSL
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.