Back to tutorials
Tutorial

Enable HTTP/3 on Nginx With QUIC on Ubuntu VPS

Enable HTTP/3 Nginx on Ubuntu VPS with QUIC, UDP 443 firewall rules, and real verification tests you can run right now.

By Anurag Singh
Updated on Nov 23, 2026
Category: Tutorial
Share article
Enable HTTP/3 on Nginx With QUIC on Ubuntu VPS

HTTP/3 isn’t a trophy feature. It fixes problems your users notice on mobile: latency spikes, flaky Wi‑Fi, and packet loss.

If you enable HTTP/3 Nginx with QUIC correctly, repeat visits often feel faster. The handshake is shorter. Loss recovery is also smoother than TCP.

This guide gets you to a working setup on an Ubuntu VPS:

  • Nginx with QUIC/HTTP/3
  • Sane TLS settings
  • The right Alt-Svc header
  • UDP 443 firewall rules
  • Checks you can run from the server and from your laptop

What you’ll build (and what you need)

  • Ubuntu Server 24.04 LTS (works similarly on 22.04 LTS, but commands here assume 24.04).
  • Nginx mainline with HTTP/3/QUIC support (packages from the official Nginx repo).
  • A real domain pointing to your server (A/AAAA records).
  • Let’s Encrypt TLS certificate via Certbot (for a clean, repeatable workflow).
  • Firewall updated to allow TCP 443 and UDP 443.

For production, start with a VPS that gives you root access and consistent networking.

A plain Ubuntu instance keeps the moving parts predictable.

HostMyCode’s HostMyCode VPS plans work well for Nginx + TLS + QUIC. You control the firewall, the kernel, and the web stack end-to-end.

Step 1 — Confirm DNS and baseline HTTPS health

HTTP/3 runs on UDP 443, but you still need working HTTPS over TCP first.

Stabilize the basics before you touch QUIC.

1) Confirm your domain points to the VPS

DOMAIN=example.com

dig +short A $DOMAIN
dig +short AAAA $DOMAIN

Expected: your VPS IPv4 address (and optionally IPv6).

If you don’t see the right IPs, fix DNS before you change Nginx.

If your registrar DNS is chaotic, HostMyCode’s domains and DNS service keeps records and TTLs easy to manage.

2) Confirm HTTPS over TCP 443 works

curl -I https://$DOMAIN/

Expected: HTTP/2 200 or HTTP/1.1 200, plus a valid certificate chain.

If you hit certificate warnings, fix TLS first.

HTTP/3 won’t “paper over” a broken cert.

If you’re behind a reverse proxy/CDN, HTTP/3 may need to be enabled at the edge instead.

This tutorial assumes your VPS terminates TLS directly.

Step 2 — Install Nginx mainline with HTTP/3 support

Ubuntu’s default Nginx packages can lag behind QUIC features.

In 2026, the most predictable path is the official Nginx repo using mainline builds.

1) Remove conflicting Nginx packages (if installed)

sudo systemctl stop nginx || true
sudo apt-get remove -y nginx nginx-common || true

2) Add the official Nginx signing key and repo

sudo apt-get update
sudo apt-get install -y curl gnupg2 ca-certificates lsb-release ubuntu-keyring

curl 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/mainline/ubuntu $(lsb_release -cs) nginx" \
  | sudo tee /etc/apt/sources.list.d/nginx.list

3) Install Nginx

sudo apt-get update
sudo apt-get install -y nginx

4) Verify the build includes HTTP/3

nginx -V 2>&1 | tr ' ' '\n' | egrep -i 'http_v3|quic|ssl|http2'

Expected: --with-http_v3_module (or equivalent) and SSL-related flags.

If HTTP/3 options aren’t in the compile output, stop here.

Fix the package source before you move on.

Keep this install boring and repeatable.

Skip random build scripts and gists unless you’re prepared to maintain them.

Step 3 — Issue/renew a Let’s Encrypt certificate

HTTP/3 requires TLS 1.3. You also want a normal public certificate.

Certbot with the Nginx plugin is the quickest way to get there. It avoids hand-editing PEM paths.

sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com

Choose the HTTPS redirect when prompted.

After issuance, verify what Certbot installed:

sudo certbot certificates

Easy mistake: you request a cert for one hostname, then test a different one.

QUIC won’t negotiate if SNI doesn’t match the certificate.

Step 4 — Open the firewall for UDP 443 (and keep TCP 443)

This is where a lot of “enabled HTTP/3” setups quietly fail.

Browsers try QUIC, can’t reach UDP 443, then fall back to HTTP/2 over TCP.

The site still works, so nobody notices.

You only catch it when you check the negotiated protocol.

If you use UFW

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 443/udp

sudo ufw status verbose

If you use firewalld (common on AlmaLinux/Rocky; included here for operators)

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=443/udp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all

Quick checks from another machine:

# TCP test
nc -vz example.com 443

# UDP test (not perfect, but gives a signal)
nc -vzu example.com 443

UDP is connectionless, so the output isn’t always definitive.

Treat this as a hint, then confirm with the HTTP/3 tests later.

Step 5 — Configure Nginx to serve HTTP/3 and advertise it safely

To actually turn this on, you need three pieces in place:

  • A TLS 1.3-capable listen 443 ssl server.
  • A QUIC listener on UDP 443 (listen 443 quic).
  • An Alt-Svc header so clients learn HTTP/3 is available.

With Nginx from the official repo, site configs usually live in /etc/nginx/conf.d/.

If Certbot edited /etc/nginx/conf.d/default.conf, you can modify it.

A dedicated vhost file is usually easier to maintain.

1) Create a dedicated server config

Create /etc/nginx/conf.d/example.com.conf:

sudo nano /etc/nginx/conf.d/example.com.conf

Paste this and adjust server_name and document root:

server {
    listen 80;
    server_name example.com www.example.com;

    # Keep ACME challenges working
    location ^~ /.well-known/acme-challenge/ {
        root /var/www/html;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    # HTTP/1.1 + HTTP/2 over TCP
    listen 443 ssl http2;

    # HTTP/3 over QUIC (UDP 443)
    listen 443 quic reuseport;

    server_name example.com www.example.com;

    # Certbot/Let's Encrypt paths (adjust if yours differ)
    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    # TLS 1.3 is required for HTTP/3
    ssl_protocols TLSv1.3;
    ssl_prefer_server_ciphers off;

    # Tell clients HTTP/3 is available.
    # Keep it short at first so you can roll back quickly.
    add_header Alt-Svc 'h3=":443"; ma=86400';
    add_header X-Content-Type-Options nosniff always;
    add_header Referrer-Policy strict-origin-when-cross-origin always;

    # QUIC requires larger UDP buffers on some hosts; Nginx uses OS buffers.
    # This is a safe starting point for most VPS sizes.
    quic_retry on;

    root /var/www/example.com/public;
    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    # If you serve PHP, wire it here (example only)
    # location ~ \.php$ {
    #     include fastcgi_params;
    #     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #     fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    # }
}

Notes that prevent headaches:

  • Keep ssl_protocols TLSv1.3; in this server block. HTTP/3 won’t negotiate over TLS 1.2.
  • Don’t drop TCP 443. Some clients can’t use QUIC, and some networks block UDP.
  • Start with a 1-day Alt-Svc max-age. If you ship a bad QUIC config, you don’t want browsers caching it for a week.

2) Create the web root and a test file

sudo mkdir -p /var/www/example.com/public
printf 'ok - %s\n' "$(date -Is)" | sudo tee /var/www/example.com/public/health.txt > /dev/null

3) Validate and reload Nginx

sudo nginx -t
sudo systemctl reload nginx

If you get “unknown directive quic”, your Nginx build doesn’t include HTTP/3.

Go back to Step 2 and confirm --with-http_v3_module is present.

Step 6 — Verification tests (server-side and client-side)

Assumptions are cheap.

Run the checks and confirm what clients negotiate.

1) Confirm Nginx is listening on UDP 443

sudo ss -lunp | grep ':443'
sudo ss -ltnp | grep ':443'

Expected: one line for UDP 443 (QUIC) and one line for TCP 443.

2) Check Alt-Svc header is present

curl -I https://example.com/health.txt | egrep -i 'alt-svc|http/|server:'

Expected: Alt-Svc: h3=":443"; ma=86400.

Without Alt-Svc, many clients won’t attempt HTTP/3.

3) Test with curl using HTTP/3

On your laptop/desktop, you need a curl build with HTTP/3 support.

Ubuntu 24.04 often includes it, but verify your build first:

curl -V | egrep -i 'http3|quic|ngtcp2|quiche|openssl'

Then run:

curl --http3 -I https://example.com/health.txt

Expected: headers return successfully.

If it times out, check UDP 443 and confirm the QUIC listener exists.

Also consider that a middlebox may be filtering UDP.

4) Verify in Chrome or Edge (quick operator check)

  1. Open chrome://net-internals/#dns and clear host cache.
  2. Load https://example.com/health.txt once.
  3. Open DevTools → Network → click the request → check Protocol.

Expected: h3 for HTTP/3, or h2 if the browser fell back.

If you need deeper visibility, Chrome NetLog will show QUIC negotiation details.

For day-to-day ops, the DevTools protocol column plus an open UDP 443 rule is usually enough.

Step 7 — Tune for real websites (WordPress, apps, and reverse proxies)

HTTP/3 helps transport performance. It doesn’t fix slow backends.

If your TTFB is high because PHP or the database is slow, QUIC won’t save you.

WordPress on Nginx: combine HTTP/3 with object caching

On most WordPress VPS installs, the next big win after page caching is Redis object caching.

If you serve logged-in traffic (WooCommerce, memberships, LMS), Redis can noticeably reduce repeated query time.

Use this tutorial for the Redis layer: Set up Redis for WordPress with Nginx and PHP-FPM. It pairs well with QUIC because repeat visits connect faster and render faster.

Reverse proxy setups (Docker, Compose, multiple apps)

If you host multiple apps on one VPS, you may already be standardizing on Traefik or Caddy.

You can run Nginx with HTTP/3 at the edge and forward traffic to internal services.

Or let Traefik handle it if that’s your baseline.

If your apps live in Docker Compose, this related guide covers HTTPS routing patterns: Traefik with Docker Compose for HTTPS on a VPS.

A practical header policy that won’t break things

Once you’ve confirmed everything negotiates cleanly, increase the Alt-Svc max-age to reduce re-probing:

# in your TLS server block
add_header Alt-Svc 'h3=":443"; ma=604800';

One week is a sensible default.

Avoid “set it for a year” until you’re confident UDP stays consistently reachable.

Step 8 — Common failures and quick fixes

Most QUIC breakage comes from simple misconfigurations.

Use these checks to narrow it down quickly.

Problem: Browser keeps using h2, never h3

  • Alt-Svc header missing → curl -I https://example.com | grep -i alt-svc
  • UDP 443 blocked → confirm UFW/firewalld rules; verify Nginx is listening on UDP with ss -lunp
  • Client network blocks UDP → test from a different network (mobile vs office Wi-Fi)

Problem: curl --http3 times out

  • Double-check that the QUIC listener is present: sudo nginx -T | grep -n 'listen 443 quic'
  • Confirm your VPS provider/security group isn’t blocking UDP 443.
  • If you use IPv6, ensure UDP 443 is allowed on v6 too (UFW handles this if IPv6 is enabled).

Problem: Certbot renews but Nginx still serves old cert

  • Reload Nginx after renew: sudo systemctl reload nginx
  • Confirm your server block references /etc/letsencrypt/live/example.com/ not a copied PEM in a custom path.

Step 9 — Operational hardening: logs, monitoring, and safe rollbacks

HTTP/3 adds another transport path.

You should be able to answer quickly whether it’s helping, or causing problems.

1) Add a dedicated access log format including protocol

In /etc/nginx/nginx.conf, inside http { }, define a format:

log_format main_ext '$remote_addr - $remote_user [$time_local] '
                    '"$request" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent" '
                    'proto=$server_protocol';

Then in your server block:

access_log /var/log/nginx/example.com.access.log main_ext;
error_log  /var/log/nginx/example.com.error.log warn;

Reload Nginx and tail logs while you test:

sudo nginx -t && sudo systemctl reload nginx
sudo tail -f /var/log/nginx/example.com.access.log

You’ll see proto=HTTP/3.0 or proto=HTTP/2.0.

It’s the quickest sanity check you can keep running during rollout.

2) Know how to roll back in 30 seconds

If HTTP/3 looks suspicious, don’t tear down TLS.

Stop advertising it and remove the QUIC listener:

  • Comment out listen 443 quic reuseport;
  • Remove or comment add_header Alt-Svc ...
  • sudo nginx -t && sudo systemctl reload nginx

Clients will automatically fall back to HTTP/2 over TCP.

3) Pair QUIC with basic VPS security hygiene

HTTP/3 doesn’t change SSH exposure, brute-force attempts, or bot traffic patterns.

If you haven’t already, add Fail2ban for Nginx and SSH.

This guide is a solid baseline: Set up Fail2ban for Nginx on Ubuntu VPS.

Step 10 — If you’re running multiple sites: don’t forget UDP 443 per IP

QUIC shares the same port across sites on the same IP.

Each TLS vhost you want on HTTP/3 still needs the QUIC listener and the Alt-Svc header.

For each server { ... } on 443, add:

listen 443 ssl http2;
listen 443 quic reuseport;
add_header Alt-Svc 'h3=":443"; ma=604800';

If you host many domains, hand-editing dozens of vhosts gets old fast.

If you need cleaner management or account separation, a managed approach can be worth it.

That’s where managed VPS hosting can pay for itself: consistent updates, repeatable configs, and someone to sanity-check changes before they bite you.

Summary: a working HTTP/3 rollout checklist

  • DNS points to the VPS (A/AAAA correct).
  • HTTPS works over TCP 443 with a valid Let’s Encrypt cert.
  • Nginx build includes HTTP/3/QUIC support (nginx -V shows it).
  • Nginx listens on TCP 443 and UDP 443 (ss confirms).
  • Firewall allows UDP 443.
  • Alt-Svc is present.
  • curl --http3 succeeds and browser DevTools shows h3.

If you want this to stay reliable, keep the stack predictable.

Use one clean Nginx install, automated TLS renewals, and a VPS that doesn’t complicate networking.

HostMyCode’s VPS hosting gives you the control you need for QUIC, and managed VPS hosting is there if you’d rather handle updates and hardening with support.

If you’re enabling HTTP/3 in production, start on infrastructure you can patch and upgrade without surprises. A HostMyCode VPS gives you full control over Nginx, firewall rules, and TLS automation. If you’d rather not spend your time on maintenance windows and hardening checklists, choose managed VPS hosting and keep changes controlled and routine.

FAQ

Do I have to disable HTTP/2 to use HTTP/3?

No. Keep HTTP/2 on TCP 443 and add HTTP/3 on UDP 443. Clients will pick the best option they can use.

Why does my site still show HTTP/2 after I enabled QUIC?

Usually because UDP 443 is blocked (firewall or upstream), or because your server isn’t advertising HTTP/3 via the Alt-Svc header. Verify both.

Will HTTP/3 break older clients?

No, as long as you keep the normal listen 443 ssl http2; line. Older clients will continue using HTTP/1.1 or HTTP/2.

Can I use HTTP/3 with WordPress?

Yes. It’s transparent to PHP and WordPress. You still need the usual WordPress performance work (caching, Redis, sensible plugins) for good TTFB.

Enable HTTP/3 on Nginx With QUIC on Ubuntu VPS | HostMyCode