@@ -6,6 +6,15 @@ server {
66 {% block server_id -%}
77 listen {{ ssl_enabled | ternary('[::] :443 ssl', '[::] :80') }};
88 listen {{ ssl_enabled | ternary('443 ssl', '80') }};
9+
10+ {% if nginx_http 3_enabled and ssl_enabled -%}
11+ # Listen on UDP for QUIC+HTTP/3
12+ listen [::]:443 quic{% if is_first_site_use_ssl %} reuseport{% endif -%} ;
13+ listen 443 quic{% if is_first_site_use_ssl %} reuseport{% endif -%} ;
14+ {% if is_first_site_use_ssl -%} # there has to be one listen quic directive with `reuseport` for working QUIC responses in current nginx version, using the first site.
15+ {% endif %}
16+ {% endif %}
17+
918 http2 {{ nginx_http2_enabled | default(false) | ternary('on', 'off') }};
1019 http3 {{ nginx_http3_enabled | default(false) | ternary('on', 'off') }};
1120 server_name {{ site_hosts_canonical | union(multisite_subdomains_wildcards) | join(' ') }};
@@ -35,6 +44,11 @@ server {
3544 sendfile off;
3645
3746 {% endif -%}
47+
48+ {% if nginx_http 3_enabled and ssl_enabled -%}
49+ include includes/directive-only/quic-tune.conf;
50+ include includes/directive-only/http3-negotiate.conf;
51+ {% endif %}
3852 {% endblock -%}
3953
4054 {% block cache_conditions -%}
@@ -303,12 +317,24 @@ server {
303317 listen [::]:443 ssl;
304318 listen 443 ssl;
305319 {% endif -%}
320+
306321 listen [::]:80;
307322 listen 80;
323+
324+ {% if nginx_http 3_enabled and ssl_enabled -%}
325+ # Listen on UDP for QUIC+HTTP/3
326+ listen [::]:443 quic;
327+ listen 443 quic;
328+ {% endif %}
329+
308330 http2 {{ nginx_http2_enabled | default(false) | ternary('on', 'off') }};
309331 http3 {{ nginx_http3_enabled | default(false) | ternary('on', 'off') }};
310332 server_name {{ host.redirects | join(' ') }};
311333
334+ {% if nginx_http 3_enabled and ssl_enabled -%}
335+ include includes/directive-only/quic-tune.conf;
336+ {% endif %}
337+
312338 {{ self.https() -}}
313339
314340 {{ self.acme_challenge() -}}
0 commit comments