GNU/Linux >> Tutoriales Linux >  >> Ubuntu

Cómo instalar Let's Encrypt SSL para Nginx en Ubuntu 18.04 LTS

En este tutorial, le mostraremos cómo instalar Let's Encrypt SSL para Nginx en Ubuntu 18.04 LTS. Para aquellos de ustedes que no lo sabían, Let's Encrypt es una autoridad de certificación abierta y gratuita ( CA) que proporciona certificados gratuitos para sitios web y otros servicios. El servicio está respaldado por Electronic Frontier Foundation, Mozilla, Cisco Systems y Akamai. Desafortunadamente, los certificados de LetsEncrypt.org actualmente tienen una vigencia de 3 meses. Esto significa que deberá renueve su certificado trimestralmente por ahora.

Este artículo asume que tiene al menos conocimientos básicos de Linux, sabe cómo usar el shell y, lo que es más importante, aloja su sitio en su propio VPS. La instalación es bastante simple y asume que se están ejecutando en la cuenta raíz, si no, es posible que deba agregar 'sudo ' a los comandos para obtener privilegios de root. Le mostraré la instalación paso a paso Let's Encrypt SSL para Nginx en el servidor Ubuntu 18.04 LTS.

Requisitos previos

  • Un servidor que ejecuta uno de los siguientes sistemas operativos:Ubuntu 18.04.
  • Se recomienda que utilice una instalación de sistema operativo nueva para evitar posibles problemas.
  • Acceso SSH al servidor (o simplemente abra Terminal si está en una computadora de escritorio).
  • Un non-root sudo user o acceder al root user . Recomendamos actuar como un non-root sudo user , sin embargo, puede dañar su sistema si no tiene cuidado al actuar como root.

Instalar Let's Encrypt SSL para Nginx en Ubuntu 18.04 LTS Bionic Beaver

Paso 1. Primero, asegúrese de que todos los paquetes de su sistema estén actualizados ejecutando el siguiente apt-get comandos en la terminal.

apt-get update
apt-get upgrade

Paso 2. Instalar Let's Encrypt SSL en Ubuntu 18.04 LTS.

Primero, agregue Certbot al repositorio:

sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install python-certbot-nginx

Paso 3. Configure el nombre de dominio en el bloque del servidor.

Certbot automatiza la configuración de SSL para Nginx buscando la directiva server_name que coincida con el dominio para el que está solicitando un certificado. Si ya configuró la directiva server_name anteriormente, puede saltar al Paso 4.

Paso 4. Genere certificados usando Certbot.

Primero, ahora podemos generar certificados usando Certbot. Reemplace idroot.us con su propio dominio:

sudo certbot --nginx -d idroot.us -d www.idroot.us

Ingrese una dirección de correo electrónico donde se le pueda contactar en caso de renovación urgente y avisos de seguridad:

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:

Presione a y ENTER para aceptar los Términos de servicio:

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:

Presione n y ENTER para no compartir su dirección de correo electrónico 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

Si tiene éxito, podrá elegir entre habilitar el acceso HTTP y https o forzar todas las solicitudes a redirigir 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):

Presione 2 y ENTER para redirigir el tráfico HTTP a 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

Paso 5. Configure la renovación automática de Let's Encrypt.

Los certificados de Let's Encrypt son válidos por 3 meses, deben verificarse para su renovación periódicamente. Certbot se ejecutará automáticamente dos veces al día y renovará cualquier certificado que esté dentro de los treinta días de vencimiento:

sudo certbot renew --dry-run

¡Felicitaciones! Ha instalado correctamente Let's Encrypt. Gracias por usar este tutorial para instalar Let's Encrypt SSL en el sistema Ubuntu 18.04 LTS Bionic Beaver. Para obtener ayuda adicional o información útil, le recomendamos que consulte la Sitio web de Let's Encrypt.


Ubuntu
  1. Cómo instalar Nginx en Ubuntu 16.04

  2. Cómo instalar Let's Encrypt SSL para NGINX en Rocky Linux 8

  3. Cómo instalar R en Ubuntu 18.04 LTS

  4. Cómo instalar R en Ubuntu 20.04 LTS

  5. Cómo instalar Let's Encrypt SSL en Ubuntu 18.04 con Nginx

Cómo instalar LEMP en Ubuntu 18.04 LTS

Cómo instalar LEMP en Ubuntu 20.04 LTS

Cómo instalar el módulo Brotli para Nginx en Ubuntu 20.04 LTS

Cómo instalar Nginx con Let's Encrypt SSL en Ubuntu 20.04 LTS

Cómo instalar Apache con Let's Encrypt SSL en Ubuntu 20.04 LTS

Cómo instalar Nginx en Ubuntu 22.04