-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·56 lines (45 loc) · 1.4 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
set -eou pipefail
openssl dhparam -out /etc/nginx/ssl/dhparams.pem 2048
baseDomain=$(echo "${DOMAINS}" | cut -f1 -d",")
touch "/etc/nginx/ssl/${baseDomain}.conf"
echo "Stubbed: /etc/nginx/ssl/${baseDomain}.conf"
nginx
CERTBOT_STAGING="${CERTBOT_STAGING:-"false"}"
certificateDir="${LETSENCRYPT_PRODUCTION_DIR}"
if [ $CERTBOT_STAGING = "true" ] || [ $CERTBOT_STAGING = "yes" ] ; then
certificateDir="${LETSENCRYPT_STAGING_DIR}"
echo "Creating staging certificates: ${certificateDir}"
certbot \
certonly \
--webroot \
--webroot-path /var/www/certbot_webroot \
--domains "${DOMAINS}" \
--agree-tos \
--email [email protected] \
--noninteractive \
--staging \
--config-dir "${certificateDir}"
else
echo "Creating production certificates"
certbot \
certonly \
--webroot \
--webroot-path /var/www/certbot_webroot \
--domains "${DOMAINS}" \
--expand \
--agree-tos \
--email [email protected] \
--noninteractive
fi
echo -e "
ssl_certificate ${certificateDir}/live/${baseDomain}/fullchain.pem;
ssl_certificate_key ${certificateDir}/live/${baseDomain}/privkey.pem;
" > "/etc/nginx/ssl/${baseDomain}.conf"
echo "Wrote: /etc/nginx/ssl/${baseDomain}.conf"
touch /var/log/certbot-renew.log
touch /var/log/nginx/access.log
touch /var/log/nginx/error.log
nginx -s reload
crond
tail -F /var/log/nginx/*.log /var/log/certbot-renew.log