Configure Nginx with HTTP/3 QUIC, TLS 1.3, and Brotli
This deep-dive covers nginx http3 quic brotli ubuntu with actionable analysis, practical implications, and expert insights.
Why HTTP/3 (QUIC) and Brotli Improve Real-World Page Speed
On mobile networks and lossy Wi-Fi links, HTTP/2 still suffers from TCP head-of-line blocking: a single dropped packet stalls every multiplexed CSS, JS, and API stream on that connection. HTTP/3 runs over QUIC (UDP 443) with built-in TLS 1.3, eliminating TCP handshake overhead and isolating packet loss to individual streams. Pairing HTTP/3 with Brotli compression cuts HTML, CSS, and JavaScript transfer sizes by roughly 20 percent over gzip.
Step 1: Install Official Nginx 1.26+ Repository on Ubuntu 24.04
Add the official nginx.org repository so you get native HTTP/3 QUIC support (Nginx 1.25+):
sudo apt update
sudo apt install -y curl gnupg2 ca-certificates lsb-release ubuntu-keyring
curl -fsSL https://nginx.org/keys/nginx_signing.key \
| gpg --dearmor \
| sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu $(lsb_release -cs) nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
sudo apt update
sudo apt install -y nginx
nginx -V 2>&1 | grep -o -- '--with-http_v3_module'
Seeing --with-http_v3_module confirms QUIC support is compiled in.
Step 2: Open UDP 443 in UFW and Cloud Firewall
HTTP/3 uses UDP port 443. Allow both TCP and UDP on port 443 in UFW (and make sure UDP 443 is also allowed in your cloud provider's firewall panel):
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 443/udp
sudo ufw reload
Step 3: Configure Your HTTP/3 + TLS 1.3 Server Block
Create or update /etc/nginx/conf.d/example.conf. Remember to place reuseport on only one listen 443 quic directive per IP across your entire Nginx configuration:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 quic reuseport;
listen [::]:443 quic reuseport;
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name example.com www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# TLS 1.3 required for HTTP/3 QUIC
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_early_data on;
quic_retry on;
quic_gso on;
# Advertise HTTP/3 support to browsers
add_header Alt-Svc 'h3=":443"; ma=86400' always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Brotli compression (when ngx_brotli module is loaded)
brotli on;
brotli_comp_level 5;
brotli_static on;
brotli_types text/plain text/css application/json application/javascript application/xml image/svg+xml;
# Gzip fallback for older clients
gzip on;
gzip_comp_level 5;
gzip_types text/plain text/css application/json application/javascript application/xml image/svg+xml;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Early-Data $ssl_early_data;
}
}
Note: If you have not loaded the dynamic ngx_brotli module yet, comment out the four brotli* lines while verifying HTTP/3 first, or compile ngx_brotli matching your exact nginx -v release.
Step 4: Test Configuration and Verify HTTP/3 Negotiation
sudo nginx -t
sudo systemctl reload nginx
# Verify Alt-Svc header is advertised
curl -sI https://example.com | grep -i alt-svc
You should see alt-svc: h3=":443"; ma=86400. Open your site in Chrome or Firefox DevTools, refresh once, and confirm the Protocol column switches from h2 to h3.
Summary
Enabling HTTP/3 QUIC, TLS 1.3, and Brotli in Nginx 1.26+ on Ubuntu 24.04 cuts connection latency on mobile networks and shrinks asset transfer payloads with minimal server overhead.
Was this technical analysis helpful?
Your feedback informs our benchmark updates and ongoing article audits.
FAQ
Frequently Asked Questions
Structured for search engines and AI answer systems (AEO/GEO).
Check three things: UDP port 443 must be open in both UFW and your cloud firewall (AWS/Hetzner/DigitalOcean), the Alt-Svc header must be present on the response, and remember the very first page load uses HTTP/2 before upgrading subsequent requests to HTTP/3.
Ubuntu 24.04 default APT ships Nginx 1.24, which predates stable HTTP/3 support. Installing Nginx 1.26+ from the official nginx.org repository gives you native QUIC and HTTP/3 built in.
Use brotli_comp_level 4 or 5 for dynamic responses. Levels 9 to 11 are far too CPU-intensive for on-the-fly compression and should only be used to pre-compress static .br files at build time.
Run curl -I --http3-only https://yourdomain.com (with an HTTP/3-enabled curl) or inspect the Protocol column in Chrome DevTools Network tab for h3.
More answers in our FAQ hub.
Newsletter
Practical Linux & Applied AI Newsletter
Get new tested tutorials and benchmark comparisons delivered directly to your inbox. Zero spam.
Join Weekly guides readers getting our weekly digest.
- Practical Linux administration & terminal workflows
- Tested open-source AI setups & benchmarks
- Zero spam - unsubscribe anytime