@@ -27,7 +27,7 @@ function check_docker_socket {
27
27
fi
28
28
}
29
29
30
- function check_writable_directory {
30
+ function check_dir_is_mounted_volume {
31
31
local dir=" $1 "
32
32
if [[ $( get_self_cid) ]]; then
33
33
if ! docker_api " /containers/$( get_self_cid) /json" | jq " .Mounts[].Destination" | grep -q " ^\" $dir \" $" ; then
@@ -36,6 +36,13 @@ function check_writable_directory {
36
36
else
37
37
echo " Warning: can't check if '$dir ' is a mounted volume without self container ID."
38
38
fi
39
+ }
40
+
41
+ function check_writable_directory {
42
+ local dir=" $1 "
43
+
44
+ check_dir_is_mounted_volume " $dir "
45
+
39
46
if [[ ! -d " $dir " ]]; then
40
47
echo " Error: can't access to '$dir ' directory !" >&2
41
48
echo " Check that '$dir ' directory is declared as a writable volume." >&2
@@ -49,6 +56,18 @@ function check_writable_directory {
49
56
rm -f " $dir /.check_writable"
50
57
}
51
58
59
+ function warn_html_directory {
60
+ local dir=' /usr/share/nginx/html'
61
+
62
+ check_dir_is_mounted_volume " $dir "
63
+
64
+ if [[ ! -d " $dir " ]] || ! touch " $dir /.check_writable" 2> /dev/null; then
65
+ echo " Warning: can't access or write to '$dir ' directory. This will prevent HTML-01 challenges from working correctly."
66
+ echo " If you are only using DNS-01 challenges, you can ignore this warning, otherwise check that '$dir ' is declared as a writable volume."
67
+ fi
68
+ rm -f " $dir /.check_writable"
69
+ }
70
+
52
71
function check_dh_group {
53
72
# DH params will be supplied for acme-companion here:
54
73
local DHPARAM_FILE=' /etc/nginx/certs/dhparam.pem'
@@ -176,7 +195,7 @@ if [[ "$*" == "/bin/bash /app/start.sh" ]]; then
176
195
check_writable_directory ' /etc/nginx/certs'
177
196
parse_true " ${ACME_HTTP_CHALLENGE_LOCATION:= false} " && check_writable_directory ' /etc/nginx/vhost.d'
178
197
check_writable_directory ' /etc/acme.sh'
179
- check_writable_directory ' /usr/share/nginx/html '
198
+ warn_html_directory
180
199
if [[ -f /app/letsencrypt_user_data ]]; then
181
200
check_writable_directory ' /etc/nginx/vhost.d'
182
201
check_writable_directory ' /etc/nginx/conf.d'
0 commit comments