How to enable HTTP/2 in Tengine
2026-09-30
HTTP/2 multiplexes many requests over one connection, which makes HTTPS sites noticeably faster — especially for sites with lots of CSS, JS, and images. Enabling it in Tengine is one line on the listen directive, provided your build includes the module. Here is the exact change and how to confirm it is live.
Step 1 — Check the module
HTTP/2 support is compiled in with --with-http_v2_module. Verify:
nginx -V 2>&1 | grep -o "http_v2_module"
If nothing prints, rebuild Tengine with that flag (see my compile guide). Most prebuilt Tengine packages include it.
Step 2 — Add http2 to the listen line
HTTP/2 in Tengine runs over TLS, so the server block must have SSL configured. Add http2 to the 443 listener:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name yourdomain.com;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
}
Step 3 — Reload and verify
nginx -t && nginx -s reload
curl -I --http2 https://yourdomain.com/
If curl reports HTTP/2 200 (instead of HTTP/1.1), you are live. In Chrome, open DevTools → Network → Protocol column to double-check h2.
Notes from production
- HTTP/2 requires TLS; there is no plaintext h2c by default. No cert, no HTTP/2.
- Put
http2only on the 443 listener — putting it on port 80 breaks the redirect chain. - HTTP/2 shines on many-requests-per-page sites. For a mostly-cached static site, the gain is smaller — pair it with static caching for the real win.
Summary
Check http_v2_module, add http2 to the 443 listener, reload, verify with curl --http2. Ten minutes of setup, no app changes. While you are at it, my Brotli guide stacks the other free performance win on top.