Skip to content

Commit e6f31f0

Browse files
committed
docs: update DNS-01 doc
1 parent 24d76fb commit e6f31f0

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

docs/Let's-Encrypt-and-ACME.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,52 @@ The following environment variables are optional and parametrize the way the Let
1212

1313
#### DNS-01 ACME challenge
1414

15-
In order to switch to the DNS-01 ACME challenge, set the `ACME_CHALLENGE` environment variable to `DNS-01` on your proxied container. This will also require you to set the `ACMESH_DNS_API_CONFIG` environment variable to a JSON or YAML string containing the configuration for the DNS provider you are using. Inside the JSON or YAML string, the `DNS_API` property is always required and should be set to the name of the [acme.sh DNS API](https://github.com/acmesh-official/acme.sh/tree/3.0.7/dnsapi) you want to use.
15+
In order to switch to the DNS-01 ACME challenge, set the `ACME_CHALLENGE` environment variable to `DNS-01` on your acme-companion container. This will also require you to set the `ACMESH_DNS_API_CONFIG` environment variable to a JSON or YAML string containing the configuration for the DNS provider you are using. Inside the JSON or YAML string, the `DNS_API` property is always required and should be set to the name of the [acme.sh DNS API](https://github.com/acmesh-official/acme.sh/tree/3.0.7/dnsapi) you want to use.
1616

1717
The other properties required will depend on the DNS provider you are using. For more information on the required properties for each DNS provider, please refer to the [acme.sh documentation](https://github.com/acmesh-official/acme.sh/wiki/dnsapi) (please keep in mind that nginxproxy/acme-companion is using a fixed version of acme.sh, so the documentation might include DNS providers that are not yet available in the version used by this image).
1818

19-
Example using the [Gandi Live DNS API](https://github.com/acmesh-official/acme.sh/blob/3.0.7/dnsapi/dns_gandi_livedns.sh):
19+
Both `ACME_CHALLENGE` and `ACMESH_DNS_API_CONFIG` environment variables can also be set on the proxied application container, in which case they will override the values set on the acme-companion container, if any.
20+
21+
Not: if you do not plan on using the `HTTP-01` challenge at all, you won't need to share `/usr/share/nginx/html` between the **nginx-proxy** and **acme-companion** containers, and can remove this volume from both.
22+
23+
Example using [Cloudflare DNS](https://github.com/acmesh-official/acme.sh/blob/master/dnsapi/dns_cf.sh):
2024
```console
2125
docker run --detach \
22-
--name your-proxyed-app \
23-
--env "VIRTUAL_HOST=yourdomain.tld" \
24-
--env "LETSENCRYPT_HOST=yourdomain.tld" \
26+
--name nginx-proxy-acme \
27+
--volume certs:/etc/nginx/certs \
28+
--volume acme:/etc/acme.sh \
29+
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
30+
2531
--env "ACME_CHALLENGE=DNS-01" \
26-
--env "ACMESH_DNS_API_CONFIG={'DNS_API': 'dns_gandi_livedns', 'GANDI_LIVEDNS_KEY': 'yourApiKey'}" \
27-
nginx
32+
--env "ACMESH_DNS_API_CONFIG={'DNS_API': 'dns_cf', 'CF_Key': 'yourCloudflareApiKey', 'CF_Email': 'yourCloudflareAccountEmail'}" \
33+
nginxproxy/acme-companion
2834
```
2935

3036
Same example on a Docker compose file:
3137
```yaml
3238
services:
33-
# [...]
39+
# nginx proxy container omitted
3440

35-
app:
36-
image: nginx
37-
container_name: your-proxyed-app
41+
acme:
42+
image: nginxproxy/acme-companion
43+
container_name: nginx-proxy-acme
44+
volumes:
45+
- certs:/etc/nginx/certs
46+
- acme:/etc/acme.sh
47+
- /var/run/docker.sock:/var/run/docker.sock:ro
3848
environment:
39-
VIRTUAL_HOST: yourdomain.tld
40-
LETSENCRYPT_HOST: yourdomain.tld
49+
DEFAULT_EMAIL: [email protected]
4150
ACME_CHALLENGE: DNS-01
4251
ACMESH_DNS_API_CONFIG: |-
43-
DNS_API: dns_gandi_livedns
44-
GANDI_LIVEDNS_KEY: yourApiKey
52+
DNS_API: dns_cf
53+
CF_Key: yourCloudflareApiKey
54+
CF_Email: yourCloudflareAccountEmail
55+
56+
# app container omitted
57+
58+
volumes:
59+
certs:
60+
acme:
4561
```
4662
4763
If you experience issues with the DNS-01 ACME challenge, please try to get it working outside of the container before opening an issue. If you can't get it working outside of the container, please seek support on the [acme.sh repository](https://github.com/acmesh-official).

0 commit comments

Comments
 (0)