In questo tutorial, ti mostreremo come installare Let's Encrypt SSL per Nginx su Ubuntu 18.04 LTS. Per chi non lo sapesse, Let's Encrypt è un'autorità di certificazione aperta gratuita ( CA) che fornisce certificati gratuiti per siti Web e altri servizi. Il servizio è supportato da Electronic Frontier Foundation, Mozilla, Cisco Systems e Akamai. Sfortunatamente, i certificati LetsEncrypt.org hanno attualmente una durata di 3 mesi. Ciò significa che dovrai rinnova il tuo certificato trimestralmente per ora.
Questo articolo presuppone che tu abbia almeno una conoscenza di base di Linux, sappia come usare la shell e, soprattutto, che ospiti il tuo sito sul tuo VPS. L'installazione è abbastanza semplice e presuppone che tu sono in esecuzione nell'account root, in caso contrario potrebbe essere necessario aggiungere 'sudo
' ai comandi per ottenere i privilegi di root. Ti mostrerò l'installazione passo passo Let's Encrypt SSL per Nginx sul server Ubuntu 18.04 LTS.
Prerequisiti
- Un server che esegue uno dei seguenti sistemi operativi:Ubuntu 18.04.
- Si consiglia di utilizzare una nuova installazione del sistema operativo per prevenire potenziali problemi.
- Accesso SSH al server (o semplicemente apri Terminal se sei su un desktop).
- Un
non-root sudo user
o accedere all'root user
. Ti consigliamo di agire comenon-root sudo user
, tuttavia, poiché puoi danneggiare il tuo sistema se non stai attento quando agisci come root.
Installa Let's Encrypt SSL per Nginx su Ubuntu 18.04 LTS Bionic Beaver
Passaggio 1. Innanzitutto, assicurati che tutti i pacchetti di sistema siano aggiornati eseguendo il seguente apt-get
comandi nel terminale.
apt-get update apt-get upgrade
Passaggio 2. Installazione di Let's Encrypt SSL su Ubuntu 18.04 LTS.
In primo luogo, aggiungi Certbot al repository:
sudo add-apt-repository ppa:certbot/certbot sudo apt update sudo apt install python-certbot-nginx
Passaggio 3. Imposta il nome di dominio su Blocco server.
Certbot automatizza la configurazione di SSL per Nginx cercando la direttiva server_name che corrisponde al dominio per cui stai richiedendo un certificato. Se hai già configurato la direttiva server_name in precedenza, puoi saltare al passaggio 4.
Passaggio 4. Genera certificati utilizzando Certbot.
Primo, ora possiamo generare certificati utilizzando Certbot. Sostituisci idroot.us con il tuo dominio:
sudo certbot --nginx -d idroot.us -d www.idroot.us
Inserisci un indirizzo email a cui essere contattato in caso di rinnovo urgente e avvisi di sicurezza:
Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v01.api.letsencrypt.org/directory ------------------------------------------------------------------------------- (A)gree/(C)ancel:
Premi a e INVIO per accettare i Termini di servizio:
Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about EFF and our work to encrypt the web, protect its users and defend digital rights. ------------------------------------------------------------------------------- (Y)es/(N)o:
Premi n e INVIO per non condividere il tuo indirizzo email con EFF:
Obtaining a new certificate Performing the following challenges: http-01 challenge for idroot.us http-01 challenge for idroot.us Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/default Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/default
In caso di successo, potrai scegliere tra abilitare l'accesso HTTP e https o forzare il reindirizzamento di tutte le richieste a https:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. ------------------------------------------------------------------------------- 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. ------------------------------------------------------------------------------- Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
Premi 2 e INVIO per reindirizzare il traffico HTTP su HTTPS:
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/default Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/default ------------------------------------------------------------------------------- Congratulations! You have successfully enabled https://idroot.us and https://www.idroot.us You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=idroot.us https://www.ssllabs.com/ssltest/analyze.html?d=www.idroot.us ------------------------------------------------------------------------------- IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/idroot.us/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/idroot.us/privkey.pem Your cert will expire on 2018-12-05. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Passaggio 5. Imposta il rinnovo automatico Let's Encrypt.
I certificati Let's Encrypt sono validi per 3 mesi, devono essere controllati periodicamente per il rinnovo. Certbot verrà eseguito automaticamente due volte al giorno e rinnoverà qualsiasi certificato entro trenta giorni di scadenza:
sudo certbot renew --dry-run
Congratulazioni! Hai installato con successo Let's Encrypt. Grazie per aver utilizzato questo tutorial per l'installazione di Let's Encrypt SSL su Ubuntu 18.04 LTS Bionic Beaver system. Per ulteriore aiuto o informazioni utili, ti consigliamo di controllare il Crittografiamo il sito web.