letsencrypt-acme-challenge.conf 1.4 KB

123456789101112131415161718192021222324252627282930
  1. # Rule for legitimate ACME Challenge requests (like /.well-known/acme-challenge/xxxxxxxxx)
  2. # We use ^~ here, so that we don't check other regexes (for speed-up). We actually MUST cancel
  3. # other regex checks, because in our other config files have regex rule that denies access to files with dotted names.
  4. location ^~ /.well-known/acme-challenge/ {
  5. # Since this is for letsencrypt authentication of a domain and they do not give IP ranges of their infrastructure
  6. # we need to open up access by turning off auth and IP ACL for this location.
  7. auth_basic off;
  8. auth_request off;
  9. allow all;
  10. # Set correct content type. According to this:
  11. # https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
  12. # Current specification requires "text/plain" or no content header at all.
  13. # It seems that "text/plain" is a safe option.
  14. default_type "text/plain";
  15. # This directory must be the same as in /etc/letsencrypt/cli.ini
  16. # as "webroot-path" parameter. Also don't forget to set "authenticator" parameter
  17. # there to "webroot".
  18. # Do NOT use alias, use root! Target directory is located here:
  19. # /var/www/common/letsencrypt/.well-known/acme-challenge/
  20. root /data/letsencrypt-acme-challenge;
  21. }
  22. # Hide /acme-challenge subdirectory and return 404 on all requests.
  23. # It is somewhat more secure than letting Nginx return 403.
  24. # Ending slash is important!
  25. location = /.well-known/acme-challenge/ {
  26. return 404;
  27. }