···6667</section>
6869+<section><title>Using ACME certificates in Nginx</title>
70+<para>In practice ACME is mostly used for retrieval and renewal of
71+ certificates that will be used in a webserver like Nginx. A configuration for
72+ Nginx that uses the certificates from ACME for
73+ <literal>foo.example.com</literal> will look similar to:
74+</para>
75+76+<programlisting>
77+services.nginx.httpConfig = ''
78+ server {
79+ server_name foo.example.com;
80+ listen 443 ssl;
81+ ssl_certificate ${config.security.acme.directory}/foo.example.com/fullchain.pem;
82+ ssl_certificate_key ${config.security.acme.directory}/foo.example.com/key.pem;
83+ root /var/www/foo.example.com/;
84+ }
85+'';
86+</programlisting>
87+88+<para>Now Nginx will try to use the certificates that will be retrieved by ACME.
89+ ACME needs Nginx (or any other webserver) to function and Nginx needs
90+ the certificates to actually start. For this reason the ACME module
91+ automatically generates self-signed certificates that will be used by Nginx to
92+ start. After that Nginx is used by ACME to retrieve the actual ACME
93+ certificates. <literal>security.acme.preliminarySelfsigned</literal> can be
94+ used to control whether to generate the self-signed certificates.
95+</para>
96+</section>
97</chapter>