Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nginx
GitHub Repository: nginx/nginx.org
Path: blob/main/xml/en/docs/quic.xml
1 views
1
<!--
2
Copyright (C) Nginx, Inc.
3
-->
4
5
<!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
6
7
<article name="Support for QUIC and HTTP/3"
8
link="/en/docs/quic.html"
9
lang="en"
10
rev="3">
11
12
<section>
13
14
<para>
15
Support for
16
<link url="https://datatracker.ietf.org/doc/html/rfc9000">QUIC</link>
17
and
18
<link url="https://datatracker.ietf.org/doc/html/rfc9114">HTTP/3</link>
19
protocols is available since 1.25.0, it is included in
20
Linux <link doc="../linux_packages.xml">binary packages</link>.
21
Please refer to the
22
<link doc="http/ngx_http_v3_module.xml">ngx_http_v3_module</link>
23
documentation.
24
</para>
25
26
</section>
27
28
29
<section id="building" name="Building from sources">
30
31
<para>
32
The build is configured using the <command>configure</command> command.
33
Please refer to <link doc="configure.xml"/> for details.
34
</para>
35
36
<para>
37
The <link url="https://openssl.org">OpenSSL</link> library
38
version 3.5.1 or higher is recommended to build nginx with QUIC support.
39
Otherwise, the <link url="https://openssl.org">OpenSSL</link>
40
compatibility layer will be used that does not support
41
<link doc="http/ngx_http_ssl_module.xml" id="ssl_early_data">early data</link>.
42
Alternatively,
43
<link url="https://boringssl.googlesource.com/boringssl">BoringSSL</link>,
44
<link url="https://www.libressl.org">LibreSSL</link>, or
45
<link url="https://github.com/quictls/openssl">QuicTLS</link>
46
prebuilt libraries can be used.
47
</para>
48
49
<para>
50
Use the following command to configure nginx with
51
<link url="https://boringssl.googlesource.com/boringssl">BoringSSL</link>:
52
<programlisting>
53
./configure
54
--with-debug
55
--with-http_v3_module
56
--with-cc-opt="-I../boringssl/include"
57
--with-ld-opt="-L../boringssl/build -lstdc++"
58
</programlisting>
59
</para>
60
61
<para>
62
Alternatively, nginx can be configured with
63
<link url="https://github.com/quictls/openssl">QuicTLS</link>:
64
<programlisting>
65
./configure
66
--with-debug
67
--with-http_v3_module
68
--with-cc-opt="-I../quictls/build/include"
69
--with-ld-opt="-L../quictls/build/lib"
70
</programlisting>
71
</para>
72
73
<para>
74
Alternatively, nginx can be configured with
75
<link url="https://www.libressl.org">LibreSSL</link>:
76
<programlisting>
77
./configure
78
--with-debug
79
--with-http_v3_module
80
--with-cc-opt="-I../libressl/build/include"
81
--with-ld-opt="-L../libressl/build/lib"
82
</programlisting>
83
</para>
84
85
<para>
86
After configuration,
87
nginx is compiled and installed using <command>make</command>.
88
</para>
89
90
</section>
91
92
93
<section id="configuration" name="Configuration tips">
94
95
<para>
96
The <link doc="http/ngx_http_core_module.xml" id="listen"/> directive in
97
<link doc="http/ngx_http_core_module.xml">ngx_http_core_module</link>
98
module got a new parameter
99
<link doc="http/ngx_http_core_module.xml" id="quic">quic</link>
100
which enables HTTP/3 over QUIC on the specified port.
101
</para>
102
103
<para>
104
Along with the <literal>quic</literal> parameter
105
it is also possible to specify the
106
<link doc="http/ngx_http_core_module.xml" id="reuseport">reuseport</link>
107
parameter to make it work properly with multiple workers.
108
</para>
109
110
<para>
111
To <link doc="http/ngx_http_v3_module.xml" id="quic_retry">enable</link>
112
address validation:
113
<programlisting>
114
quic_retry on;
115
</programlisting>
116
117
To <link doc="http/ngx_http_ssl_module.xml" id="ssl_early_data">enable</link>
118
0-RTT:
119
<programlisting>
120
ssl_early_data on;
121
</programlisting>
122
123
To <link doc="http/ngx_http_v3_module.xml" id="quic_gso">enable</link>
124
GSO (Generic Segmentation Offloading):
125
<programlisting>
126
quic_gso on;
127
</programlisting>
128
129
To <link doc="http/ngx_http_v3_module.xml" id="quic_host_key">set</link>
130
host key for various tokens:
131
<programlisting>
132
quic_host_key &lt;filename&gt;;
133
</programlisting>
134
</para>
135
136
<para>
137
QUIC requires TLSv1.3 protocol version which is enabled by default
138
in the <link doc="http/ngx_http_ssl_module.xml" id="ssl_protocols"/> directive.
139
</para>
140
141
<para>
142
By default,
143
<link url="http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf">GSO Linux-specific optimization</link>
144
is disabled.
145
Enable it in case a corresponding network interface is configured
146
to support GSO.
147
</para>
148
149
</section>
150
151
152
<section id="troubleshooting " name="Troubleshooting">
153
154
<para>
155
Tips that may help to identify problems:
156
<list type="bullet">
157
158
<listitem>
159
Ensure nginx is built with the proper SSL library.
160
</listitem>
161
162
<listitem>
163
Ensure nginx is using the proper SSL library in runtime
164
(the <literal>nginx -V</literal> shows what it is currently used).
165
</listitem>
166
167
<listitem>
168
Ensure a client is actually sending requests over QUIC.
169
It is recommended to start with a simple console client such as
170
<link url="https://nghttp2.org/ngtcp2">ngtcp2</link>
171
to ensure the server is configured properly before trying
172
with real browsers that may be quite picky with certificates.
173
</listitem>
174
175
<listitem>
176
Build nginx with <link doc="debugging_log.xml">debug support</link>
177
and check the debug log.
178
It should contain all details about the connection and why it failed.
179
All related messages contain the ā€œ<literal>quic</literal>ā€ prefix
180
and can be easily filtered out.
181
</listitem>
182
183
<listitem>
184
For a deeper investigation, additional debugging can be enabled
185
using the following macros:
186
<literal>NGX_QUIC_DEBUG_PACKETS</literal>,
187
<literal>NGX_QUIC_DEBUG_FRAMES</literal>,
188
<literal>NGX_QUIC_DEBUG_ALLOC</literal>,
189
<literal>NGX_QUIC_DEBUG_CRYPTO</literal>.
190
191
<para>
192
<programlisting>
193
./configure
194
--with-http_v3_module
195
--with-debug
196
--with-cc-opt="-DNGX_QUIC_DEBUG_PACKETS -DNGX_QUIC_DEBUG_CRYPTO"
197
</programlisting>
198
</para>
199
</listitem>
200
201
</list>
202
</para>
203
204
</section>
205
206
</article>
207
208