http3 on latest Nginx

Hi guys!

I spent the last two days trying to make the most modern nginx configuration on my server. One of the obstacles I encountered was http3 support on which I spent more time than I want to believe.

I stumbled upon this nginx autoinstall script which was really helpful and made everything about 1000 percent easier. It builds nginx with only the things you want and it has some more features. One of the options is http3 support which is provided by boringssl and quiche from Cloudflare. The thing is that the nginx version higher than 1.16 is going to error out when installing http3 because Cloudflare is not patching their implementation for higher versions of nginx.

I found a patch online for that and forked the original script to automatically apply it and now you can use this script even for the lastest nginx to support http3 until nginx-quic will actually have a normal release so you can use it. The link for my fork is here: [](
You can use this script to just update your nginx as it will not overwrite your .confs.

The original author did a pretty good job and offers even an http3 configuration example which should look like this.

server {
# Enable QUIC and HTTP/3
listen 443 quic reuseport;

# Enable HTTP/2 (optional)
listen 443 ssl http2;

ssl_certificate cert.crt;
ssl_certificate_key cert.key;

# Enable all TLS versions (TLSv1.3 is required for QUIC)
ssl_protocols TLSv1.2 TLSv1.3;
location / {
# Add Alt-Svc header to negotiate HTTP/3
add_header alt-svc 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"';

If you want to host more than one http3 enabled server, remove the `reuseport` option on every server after the first one or you will get an nginx error because of a duplicate listener.

I hope I help at least someone with this as I spent an absurd amount of time on this which I would like to save you.

1 thought on “http3 on latest Nginx”

Leave a Comment