Nginx · The edge of your stack

How do you enable HTTP/2 and what does it change?

Mediumhttp/2alpnmultiplexingUpdated Oct 2026
Quiz this track

Short answer

Enable HTTP/2 on a TLS listener. It multiplexes many requests over one connection and compresses headers, which reduces connection overhead but does not remove TCP-level head-of-line blocking.

Clients negotiate HTTP/2 through ALPN during the TLS handshake. Nginx then multiplexes streams over a single connection. Browsers no longer support HTTP/2 server push, so do not plan around it.

nginx
server {
    listen 443 ssl;
    http2 on;
    server_name example.com;

    ssl_certificate /etc/nginx/tls/fullchain.pem;
    ssl_certificate_key /etc/nginx/tls/privkey.pem;

    location / {
        proxy_pass http://app;
    }
}
Current Nginx uses the http2 directive. Older versions used listen 443 ssl http2.

What changes in practice

  • Many requests share one TLS connection, reducing handshake and connection overhead
  • Header compression reduces repeated metadata
  • Streams are independent at the HTTP layer but still share one TCP connection
  • gRPC requires HTTP/2 end to end, so use grpc_pass or an HTTP/2-capable upstream rather than plain proxy_pass
  • HTTP/3 uses QUIC over UDP and is configured separately
HTTP/2 can worsen performance on lossy networks because a dropped TCP packet blocks all streams. HTTP/3 addresses that at the transport layer, but it adds operational complexity.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1How does a client negotiate HTTP/2 with Nginx?
  2. 2Does HTTP/2 eliminate head-of-line blocking?
  3. 3Why did browsers remove HTTP/2 server push?
  4. 4What is required to proxy gRPC traffic?

Say it in the interview

I enable HTTP/2 on the TLS server, either with the modern http2 directive or the older listen parameter. Clients negotiate it through ALPN, then multiplex requests over one connection. That cuts connection overhead, but TCP head-of-line blocking remains. For gRPC I make sure the whole proxy path speaks HTTP/2, and I treat HTTP/3 as a separate QUIC deployment.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Nginx mock interview and get scored feedback on depth, clarity and confidence.