forked from nginx-proxy/nginx-proxy
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add letsencrypt service and configuration to access .well-known direc…
…tory
- Loading branch information
Showing
4 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
nginx: nginx | ||
dockergen: docker-gen -watch -only-exposed -notify "nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf | ||
letsencrypt: /app/letsencrypt_service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
echo 'Waiting' | ||
sleep 10 | ||
|
||
# Wait some amount of time | ||
seconds_to_wait=100; | ||
while true; do | ||
# for each configuration file, | ||
for f in "/etc/letsencrypt/*.ini"; do | ||
[[ -f "$f" ]] || continue | ||
echo "letsencrypt ${f%.ini}" | ||
domain="${f%.ini}" | ||
# Wait until the threshold is reached for renewing certificate | ||
# cat /etc/nginx/certs/ftl3.local.crt | openssl x509 -noout -dates | ||
|
||
# Or if the certificate doesn't exist | ||
|
||
/opt/letsencrypt/letsencrypt-auto certonly --authenticator webroot \ | ||
--webroot-path /usr/share/nginx/html -d $domain | ||
done | ||
date | ||
sleep $seconds_to_wait | ||
done | ||
|
||
# Date difference in days | ||
datediff() { | ||
d1=$(date -d "$1" +%s) | ||
d2=$(date -d "$2" +%s) | ||
echo $(( (d1 - d2) / 86400 )) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters