Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nginx
GitHub Repository: nginx/nginx.org
Path: blob/main/xml/en/docs/http/ngx_http_acme_module.xml
1 views
1
<?xml version="1.0"?>
2
3
<!--
4
Copyright (C) Nginx, Inc.
5
-->
6
7
<!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
8
9
<module name="Module ngx_http_acme_module"
10
link="/en/docs/http/ngx_http_acme_module.html"
11
lang="en"
12
rev="4">
13
14
<section id="summary">
15
16
<para>
17
The <literal>ngx_http_acme_module</literal> module implements
18
the automatic certificate management
19
(<link url="https://datatracker.ietf.org/doc/html/rfc8555">ACMEv2</link>)
20
protocol.
21
</para>
22
23
<para>
24
The source code of the module is available
25
<link url="https://github.com/nginx/nginx-acme">here</link>.
26
Download and install instructions are available
27
<link url="https://github.com/nginx/nginx-acme/blob/main/README.md">here</link>.
28
</para>
29
30
<para>
31
The module is also available in a prebuilt
32
<literal>nginx-module-acme</literal>
33
<link doc="../../linux_packages.xml" id="dynmodules">package</link>
34
and in <literal>nginx-plus-module-acme</literal> package
35
as part of our
36
<commercial_version>commercial subscription</commercial_version> since 1.29.0.
37
</para>
38
39
</section>
40
41
42
<section id="example" name="Example Configuration">
43
44
<para>
45
<example>
46
resolver 127.0.0.1:53;
47
48
acme_issuer example {
49
uri https://acme.example.com/directory;
50
contact [email protected];
51
state_path /var/cache/nginx/acme-example;
52
accept_terms_of_service;
53
}
54
55
acme_shared_zone zone=ngx_acme_shared:1M;
56
57
server {
58
listen 443 ssl;
59
server_name .example.test;
60
61
acme_certificate example;
62
63
ssl_certificate $acme_certificate;
64
ssl_certificate_key $acme_certificate_key;
65
66
# do not parse the certificate on each request
67
ssl_certificate_cache max=2;
68
}
69
70
server {
71
# listener on port 80 is required to process ACME HTTP-01 challenges
72
listen 80;
73
74
location / {
75
return 404;
76
}
77
}
78
</example>
79
</para>
80
81
</section>
82
83
84
<section id="directives" name="Directives">
85
86
<directive name="acme_issuer">
87
<syntax block="yes"><value>name</value></syntax>
88
<default/>
89
<context>http</context>
90
91
<para>
92
Defines an ACME certificate issuer object.
93
</para>
94
95
</directive>
96
97
98
<directive name="uri">
99
<syntax><value>uri</value></syntax>
100
<default/>
101
<context>acme_issuer</context>
102
103
<para>
104
The
105
<link url="https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.1">directory URL</link>
106
of the ACME server.
107
This directive is mandatory.
108
</para>
109
110
</directive>
111
112
113
<directive name="account_key">
114
<syntax><value>alg</value>[:<value>size</value>] | <value>file</value></syntax>
115
<default/>
116
<context>acme_issuer</context>
117
118
<para>
119
The account's private key used for request authentication.
120
</para>
121
122
<para>
123
Accepted values:
124
<list type="bullet">
125
126
<listitem>
127
<literal>ecdsa</literal>:<value>256</value>/<value>384</value>/<value>521</value>
128
for ES256, ES384, or ES512 JSON Web Signature algorithms
129
</listitem>
130
131
<listitem>
132
<literal>rsa</literal>:<value>2048</value>/<value>3072</value>/<value>4096</value>
133
for RS256.
134
</listitem>
135
136
<listitem>
137
File path for an existing key, using one of the algorithms above.
138
</listitem>
139
140
</list>
141
</para>
142
143
<para>
144
The generated account keys are preserved across reloads,
145
but will be lost on restart unless <link id="state_path"/> is configured.
146
</para>
147
148
</directive>
149
150
151
<directive name="challenge">
152
<syntax><value>type</value></syntax>
153
<default>http-01</default>
154
<context>acme_issuer</context>
155
<appeared-in>0.2.0</appeared-in>
156
157
<para>
158
Specifies the ACME challenge type to be used for the issuer.
159
</para>
160
161
<para>
162
Accepted values:
163
<list type="bullet">
164
165
<listitem>
166
<literal>http-01</literal> (<literal>http</literal>)
167
</listitem>
168
169
<listitem>
170
<literal>tls-alpn-01</literal> (<literal>tls-alpn</literal>)
171
</listitem>
172
173
</list>
174
</para>
175
176
<para>
177
<note>
178
ACME challenges are versioned.
179
If an unversioned name is specified,
180
the module automatically selects the latest implemented version.
181
</note>
182
</para>
183
184
</directive>
185
186
187
<directive name="common_name_in_csr">
188
<syntax><literal>on</literal> | <literal>off</literal></syntax>
189
<default>off</default>
190
<context>acme_issuer</context>
191
<appeared-in>0.4.0</appeared-in>
192
193
<para>
194
If enabled, sets the Subject Common Name in the certificate request
195
to the first DNS name or the first IP address provided.
196
</para>
197
198
<para>
199
<note>
200
Enabling this option may result in rejected certificate requests.
201
</note>
202
<note>
203
Prior to version 0.4.0, the Subject Common Name was always set.
204
</note>
205
</para>
206
207
</directive>
208
209
210
<directive name="contact">
211
<syntax><value>URL</value></syntax>
212
<default/>
213
<context>acme_issuer</context>
214
215
<para>
216
Sets an array of URLs that the ACME server can use
217
to contact the client regarding account issues.
218
The <literal>mailto:</literal> scheme will be used
219
unless specified explicitly.
220
</para>
221
222
</directive>
223
224
225
<directive name="external_account_key">
226
<syntax><value>kid</value> <value>file</value></syntax>
227
<default/>
228
<context>acme_issuer</context>
229
<appeared-in>0.2.0</appeared-in>
230
231
<para>
232
Specifies a key identifier <value>kid</value> and a <value>file</value>
233
with the MAC key for
234
<link url="https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.4">
235
external account authorization</link>.
236
</para>
237
238
<para>
239
The value <literal>data</literal>:<value>key</value> can be specified
240
instead of the <value>file</value>, which loads a key directly from
241
the configuration without using intermediate files.
242
</para>
243
244
<para>
245
In both cases, the key is expected to be encoded in
246
<link url="https://datatracker.ietf.org/doc/html/rfc4648#section-5">
247
base64url</link>.
248
</para>
249
250
</directive>
251
252
253
<directive name="preferred_chain">
254
<syntax><value>name</value></syntax>
255
<default />
256
<context>acme_issuer</context>
257
<appeared-in>0.3.0</appeared-in>
258
259
<para>
260
Specifies the preferred certificate chain.
261
</para>
262
263
<para>
264
If the ACME server offers multiple certificate chains,
265
prefer the chain with the topmost certificate issued from the
266
Subject Common Name <value>name</value>.
267
If there are no matches, the default chain will be used.
268
</para>
269
270
</directive>
271
272
273
<directive name="profile">
274
<syntax><value>name</value> [<literal>require</literal>]</syntax>
275
<default />
276
<context>acme_issuer</context>
277
<appeared-in>0.3.0</appeared-in>
278
279
<para>
280
Requests the
281
<link url="https://datatracker.ietf.org/doc/html/draft-ietf-acme-profiles">
282
certificate profile</link> <value>name</value> from the ACME server.
283
</para>
284
285
<para>
286
The <literal>require</literal> parameter will cause certificate renewals
287
to fail if the server does not support the specified profile.
288
</para>
289
290
</directive>
291
292
293
<directive name="ssl_trusted_certificate">
294
<syntax><value>file</value></syntax>
295
<default/>
296
<context>acme_issuer</context>
297
298
<para>
299
Specifies a <value>file</value> with trusted CA certificates in the PEM format
300
used to <link id="ssl_verify">verify</link> the certificate
301
of the ACME server.
302
</para>
303
304
</directive>
305
306
307
<directive name="ssl_verify">
308
<syntax>
309
<literal>on</literal> | <literal>off</literal></syntax>
310
<default>on</default>
311
<context>acme_issuer</context>
312
313
<para>
314
Enables or disables verification of the ACME server certificate.
315
</para>
316
317
</directive>
318
319
320
<directive name="state_path">
321
<syntax><value>path</value> | <literal>off</literal></syntax>
322
<default>acme_&lt;issuer&gt;</default>
323
<context>acme_issuer</context>
324
325
<para>
326
Defines a directory for storing the module data
327
that can be persisted across restarts.
328
This can improve the load time by skipping some requests on startup,
329
and avoid hitting request rate limits on the ACME server.
330
</para>
331
332
<para>
333
The directory contains sensitive content, such as
334
the account key, issued certificates, and private keys.
335
</para>
336
337
<para>
338
The <literal>off</literal> parameter (0.2.0) disables storing the account
339
information and issued certificates on disk.
340
</para>
341
342
<para>
343
<note>
344
Prior to version 0.2.0, the state directory was not created by default.
345
</note>
346
</para>
347
348
</directive>
349
350
351
<directive name="accept_terms_of_service">
352
<syntax></syntax>
353
<default/>
354
<context>acme_issuer</context>
355
356
<para>
357
Agrees to the terms of service under which the ACME server will be used.
358
Some servers require accepting the terms of service
359
before account registration.
360
The terms are usually available on the ACME server's website,
361
and the URL will be printed to the error log if necessary.
362
</para>
363
364
</directive>
365
366
367
<directive name="acme_shared_zone">
368
<syntax>
369
<literal>zone</literal>=<value>name</value>:<value>size</value></syntax>
370
<default>zone=ngx_acme_shared:256k</default>
371
<context>http</context>
372
373
<para>
374
Allows increasing the size of in-memory storage of the module.
375
The shared memory zone will be used to store the issued certificates,
376
keys and challenge data for all the configured certificate issuers.
377
</para>
378
379
<para>
380
The default zone size is sufficient to hold approximately
381
50 ECDSA prime256v1 keys or 35 RSA 2048 keys.
382
</para>
383
384
</directive>
385
386
387
<directive name="acme_certificate">
388
<syntax>
389
<value>issuer</value>
390
[<value>identifier</value> ...]
391
[<literal>key</literal>=<value>alg</value>[:<value>size</value>]]</syntax>
392
<default/>
393
<context>server</context>
394
395
<para>
396
Defines a certificate with the list of <literal>identifiers</literal>
397
requested from issuer <literal>issuer</literal>.
398
</para>
399
400
<para>
401
The explicit list of identifiers can be omitted.
402
In this case, the identifiers will be taken from the
403
<link doc="ngx_http_core_module.xml" id="server_name"/> directive
404
in the same <link doc="ngx_http_core_module.xml" id="server"/> block.
405
Not all values accepted in the <literal>server_name</literal>
406
are valid certificate identifiers:
407
regular expressions and wildcards are not supported.
408
</para>
409
410
<para>
411
The key parameter sets the type of a generated private key.
412
Supported key algorithms and sizes:
413
<literal>ecdsa:256</literal> (default),
414
<literal>ecdsa:384</literal>,
415
<literal>ecdsa:521</literal>,
416
<literal>rsa:2048</literal>,
417
<literal>rsa:3072</literal>,
418
<literal>rsa:4096</literal>.
419
</para>
420
421
</directive>
422
423
</section>
424
425
426
<section id="variables" name="Embedded Variables">
427
428
<para>
429
The <literal>ngx_http_acme_module</literal> module supports embedded variables,
430
valid in the
431
<link doc="ngx_http_core_module.xml" id="server"/> block with the
432
<link id="acme_certificate"/> directive:
433
</para>
434
435
<para>
436
<list type="tag" compact="yes">
437
438
<tag-name id="var_acme_certificate"><var>$acme_certificate</var></tag-name>
439
<tag-desc>
440
SSL certificate that can be passed to the
441
<link doc="ngx_http_ssl_module.xml" id="ssl_certificate"/>
442
</tag-desc>
443
444
<tag-name id="var_acme_certificate_key"><var>$acme_certificate_key</var></tag-name>
445
<tag-desc>
446
SSL certificate private key that can be passed to
447
<link doc="ngx_http_ssl_module.xml" id="ssl_certificate_key"/>
448
</tag-desc>
449
450
</list>
451
</para>
452
453
</section>
454
455
</module>
456
457