letsencrypt-acme-challenge.conf 1.4 KB

1234567891011121314151617181920212223242526272829
  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. allow all;
  9. # Set correct content type. According to this:
  10. # https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
  11. # Current specification requires "text/plain" or no content header at all.
  12. # It seems that "text/plain" is a safe option.
  13. default_type "text/plain";
  14. # This directory must be the same as in /etc/letsencrypt/cli.ini
  15. # as "webroot-path" parameter. Also don't forget to set "authenticator" parameter
  16. # there to "webroot".
  17. # Do NOT use alias, use root! Target directory is located here:
  18. # /var/www/common/letsencrypt/.well-known/acme-challenge/
  19. root /data/letsencrypt-acme-challenge;
  20. }
  21. # Hide /acme-challenge subdirectory and return 404 on all requests.
  22. # It is somewhat more secure than letting Nginx return 403.
  23. # Ending slash is important!
  24. location = /.well-known/acme-challenge/ {
  25. return 404;
  26. }