nginx / njs-acme

Nginx NJS module runtime to work with ACME providers like Let's Encrypt for automated no-reload TLS certificate issue/renewal.
Apache License 2.0
70 stars 11 forks source link

Use `js_content` to respond to challenge requests #14

Closed zsteinkamp closed 1 year ago

zsteinkamp commented 1 year ago

Proposed changes

With the current implementation, an nginx variable $njs_acme_challenge_dir must be defined since it is used in the /.well-known/acme-challenge location block, which uses an alias directive to serve content from that directory. It is not possible to use an environment variable for this value.

If we change to use js_content to serve challenge responses, we can eliminate the need for this special configuration variable by using a reasonable default value in the njs code.

With this change, users can still customize the location of this directory either via environment variable or nginx variable, maintaining consistency with the other configuration options.

I have tested this locally as well as on my personal server at https://steinkamp.us/