Skip to content

Instantly share code, notes, and snippets.

@jorgedison
Created March 12, 2020 00:02
Show Gist options
  • Save jorgedison/b3b1d0e6e548c3e4ff982de4ce7ce39e to your computer and use it in GitHub Desktop.
Save jorgedison/b3b1d0e6e548c3e4ff982de4ce7ce39e to your computer and use it in GitHub Desktop.

Paso 1: Instalar LetsEncrypt

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install letsencrypt

Paso 2: Configurar el certificado SSL

server {
    listen  80 default_server;
    server_name _;
    location ~ /\.well-known/acme-challenge/ {
        allow all;
        root /var/www/letsencrypt;
        try_files $uri =404;
        break;
    }
}

Paso 3: Habilitar HTTPS LetsEncrypt

sudo letsencrypt certonly -a webroot --webroot-path=/var/www/letsencrypt -m [email protected] --agree-tos -d ssl.itsynd

Paso 4: Configuracion nginx

server {
    server_name example.com;
    listen 443 ssl;
    ssl on;
    ssl_certificate     /etc/letsencrypt/live/ssl.itsyndicate.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/ssl.itsyndicate.org/privkey.pem;
    root /var/www/html/;
    index index.php index.html index.htm;
    location ~ /.well-known {
        root /var/www/letsencrypt;
        allow all;
    }
}
sudo nginx -t 
sudo service nginx reload

Paso 5: Verificar la renovación automática

#!/bin/bash
/usr/bin/letsencrypt renew && /etc/init.d/nginx reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment