|
10 | 10 |
|
11 | 11 | ncdir=/var/www/nextcloud |
12 | 12 | nc_vhostcfg=/etc/apache2/sites-available/nextcloud.conf |
13 | | -vhostcfg2=/etc/apache2/sites-available/ncp.conf |
| 13 | +ncp_vhostcfg=/etc/apache2/sites-available/ncp.conf |
14 | 14 | letsencrypt=/usr/bin/letsencrypt |
15 | 15 |
|
16 | 16 | is_active() |
@@ -58,8 +58,10 @@ configure() |
58 | 58 | rm -f /etc/letsencrypt/renewal-hooks/deploy/ncp |
59 | 59 | [[ "$DOCKERBUILD" == 1 ]] && update-rc.d letsencrypt disable |
60 | 60 | install_template nextcloud.conf.sh "${nc_vhostcfg}" |
61 | | - sed -i "s|SSLCertificateFile.*|SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem|" "${vhostcfg2}" |
62 | | - sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key|" "${vhostcfg2}" |
| 61 | + local cert_path="$(grep SSLCertificateFile "${nc_vhostcfg}" | awk '{ print $2 }')" |
| 62 | + local key_path="$(grep SSLCertificateKeyFile "${nc_vhostcfg}" | awk '{ print $2 }')" |
| 63 | + sed -i "s|SSLCertificateFile.*|SSLCertificateFile ${cert_path}|" "${ncp_vhostcfg}" |
| 64 | + sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile ${key_path}|" "${ncp_vhostcfg}" |
63 | 65 | apachectl -k graceful |
64 | 66 | echo "letsencrypt certificates disabled. Using self-signed certificates instead." |
65 | 67 | exit 0 |
|
113 | 115 |
|
114 | 116 | # Configure Apache |
115 | 117 | install_template nextcloud.conf.sh "${nc_vhostcfg}" |
116 | | - sed -i "s|SSLCertificateFile.*|SSLCertificateFile /etc/letsencrypt/live/$DOMAIN_LOWERCASE/fullchain.pem|" "${vhostcfg2}" |
117 | | - sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/letsencrypt/live/$DOMAIN_LOWERCASE/privkey.pem|" "${vhostcfg2}" |
| 118 | + local cert_path="$(grep SSLCertificateFile "${nc_vhostcfg}" | awk '{ print $2 }')" |
| 119 | + local key_path="$(grep SSLCertificateKeyFile "${nc_vhostcfg}" | awk '{ print $2 }')" |
| 120 | + sed -i "s|SSLCertificateFile.*|SSLCertificateFile ${cert_path}|" "${ncp_vhostcfg}" |
| 121 | + sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile ${key_path}|" "${ncp_vhostcfg}" |
118 | 122 |
|
119 | 123 | # Configure Nextcloud |
120 | 124 | local domain_index="${TRUSTED_DOMAINS[letsencrypt_1]}" |
|
0 commit comments