Closes #10: Delete nginx conf on certificate retrieval failure
This commit is contained in:
parent
0f3dfc0819
commit
89fceaba29
|
@ -28,6 +28,7 @@ function usage
|
|||
function get_cert
|
||||
{
|
||||
/root/.acme.sh/acme.sh --issue --domain $_domain --webroot /srv/http-content-combined/ --cert-file /etc/nginx/ssl/${_domain}.crt --key-file /etc/nginx/ssl/${_domain}.key --fullchain-file /etc/nginx/ssl/${_domain}-fullchain.crt
|
||||
return $?
|
||||
}
|
||||
|
||||
function reload_nginx
|
||||
|
@ -172,7 +173,10 @@ echo "Reloading Nginx..."
|
|||
reload_nginx
|
||||
|
||||
echo "Retrieving Let's Encrypt Certificate..."
|
||||
get_cert
|
||||
if ! get_cert; then
|
||||
rm $_vhost_conf_file
|
||||
err "Failed to retrieve certificate!"
|
||||
fi
|
||||
|
||||
cat << EOF >> $_vhost_conf_file
|
||||
|
||||
|
|
Loading…
Reference in New Issue