Problema risoluzione DNS
Inviato: sabato 24 maggio 2025, 9:40
Codice: Seleziona tutto
#!/bin/bash
read -p "Inserisci il nome del dominio (es. xx.xx.com): " DOMAIN
# Cartella webroot - personalizza se serve
WEBROOT="/var/www/html"
# Verifica che esista il VirtualHost per il dominio (opzionale)
if ! sudo apachectl -S 2>&1 | grep -q "$DOMAIN"; then
echo "Attenzione: VirtualHost per $DOMAIN non trovato in Apache."
exit 1
fi
# Richiedi il certificato usando webroot plugin
sudo certbot certonly --webroot -w "$WEBROOT" -d "$DOMAIN" --agree-tos --email tuomail@example.com --non-interactive
if [ $? -eq 0 ]; then
echo "Certificato creato con successo per $DOMAIN!"
else
echo "Errore nella creazione del certificato."
fi
Codice: Seleziona tutto
sudo systemctl stop apache2
sudo certbot certonly --standalone -d DNS
sudo systemctl start apache2