diff --git a/scripts/cloudron-support b/scripts/cloudron-support index 3e64355a1..7801cc95b 100755 --- a/scripts/cloudron-support +++ b/scripts/cloudron-support @@ -165,10 +165,18 @@ function check_unbound() { } function check_nginx() { + local -r dashboard_domain=$(mysql -NB -uroot -ppassword -e "SELECT value FROM box.settings WHERE name='dashboard_domain'" 2>/dev/null) + if ! systemctl is-active -q nginx; then - fail "nginx is down. checking if this is because of invalid certs" - # TODO: delete config files that use invalid certs and restart nginx - exit 1 + fail "nginx is down. Removing extraneous dashboard domain configs ..." + + cd /home/yellowtent/platformdata/nginx/applications/dashboard/ && find . ! -name "my.${dashboard_domain}.conf" -type f -exec rm -f {} + + systemctl restart nginx + + if ! systemctl is-active -q nginx; then + fail "nginx is still down, please investigate the error by inspecting /var/log/nginx/error.log" + exit 1 + fi fi success "nginx is running"