INSTALLARE CERTBOT
sudo add-apt-repository ppa:certbot/certbot sudo apt-get update sudo apt-get install certbot
NOTE: Sito ufficiale: https://certbot.eff.org/
CREARE UN CERTIFICATO CON CERTBOT
sudo certbot certonly -a webroot --webroot-path=/APP_PATH/public -d yourdomain.here
NOTE: /APP_PATH/public corrisponde alla path pubblica dell’applicazione. Durante questa fase certbot crea un file all’interno della directory per verificare la proprietà del dominio.
AGGIORNARE I CERTIFICATI SCADUTI CON CERTBOT
sudo certbot renew --dry-run
IMPOSTARE UN CRON DI AUTO-AGGIORNAMENTO DEI CERTIFICATI SCADUTI
sudo nano /etc/cron.d/certbot-custom 37 02 * * * root certbot -q renew --pre-hook="systemctl stop nginx" --post-hook="systemctl start nginx"
IMPOSTARE IL CERTIFICATO SU UNA CONFIGURAZIONE NGINX
server { listen 80; listen 443 ssl; # add listener on 443 path ssl_certificate /etc/letsencrypt/live/yourdomain.here/fullchain.pem; # add ssl certificate ssl_certificate_key /etc/letsencrypt/live/yourdomain.here/privkey.pem; # add ssl certificate key server_name example.com; passenger_enabled on; root /home/deploy/applications/APP_PATH/public; index index.html; }