Skip to content
local-cert
Browse the documentation

Apache httpd

The mod_md module, shipped with Apache 2.4, handles ACME directly inside the server. EAB is supported from Apache 2.4.52.

ValueWhere to find itIn this guide
ACME directoryfixed for each instancehttps://certs.example.com/acme/directory
Key ID (kid)Keys & access → EAB credentialseab_XXXXXXXXXXXXXXXX
HMAC keyshown only once, at creationCLE_HMAC

1. Enable the modules

Debian / Ubuntu
a2enmod md ssl && systemctl restart apache2

2. Configure

/etc/apache2/conf-available/local-cert.conf
MDCertificateAuthority   https://certs.example.com/acme/directory
MDCertificateAgreement   accepted
MDContactEmail           ops@example.com
MDExternalAccountBinding eab_XXXXXXXXXXXXXXXX CLE_HMAC
MDCAChallenges           http-01

MDomain nas.home.example.com

<VirtualHost *:443>
    ServerName nas.home.example.com
    SSLEngine on
    # no SSLCertificateFile: mod_md provides the certificate
    ProxyPass        / http://192.168.1.50:5000/
    ProxyPassReverse / http://192.168.1.50:5000/
</VirtualHost>

<VirtualHost *:80>
    ServerName nas.home.example.com
</VirtualHost>
enable
a2enconf local-cert && systemctl reload apache2

3. Let it run, then reload

mod_md obtains the certificate in the background, then waits for a reload to activate it. Follow progress in the error log; once it reports that the certificate is ready:

reload
systemctl reload apache2

Renewals follow the same pattern: automatic retrieval, activation on the next reload. A daily reload from cron is enough.

Good to know

  • To keep the HMAC key out of the configuration, MDExternalAccountBinding also accepts the path to a JSON file {"kid": "…", "hmac": "…"}, readable by root only.
  • If mod_md already manages public domains with Let's Encrypt, put these directives inside a <MDomain nas.home.example.com> … </MDomain> block so they only apply to internal names.