let's Encrypt certificado ssl Ubuntu 16.04



debian 8 or 9

Terminal:
apt-get install -t jessie-backports certbot

Terminal:
sudo apt-get -y install letsencrypt

Terminal:
export DOMAINS="yourdomain.here,www.yourdomain.here"

Terminal:
export DIR=/var/www/demo

Terminal:
sudo letsencrypt certonly -a webroot --webroot-path=$DIR -d $DOMAINS


Terminal:
nano /etc/nginx/sites-enabled/default





server {
    listen 443 ssl;
    server_name yourdomain.com;
    root /var/www/demo;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
}

automatic change hhtp for https

server {
       listen         80;
       server_name yourdomain.com;
       return         301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name yourdomain.com;
    root /var/www/demo;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
}






Terminal:
sudo nginx -t &&  sudo nginx -s reload


si deseas realizar un crontab que actualice automaticamente el certificado utiliza el siguiente comando cambiando las letras rojas

Terminal:
* * * */2 * sudo /usr/bin/letsencrypt certonly -a webroot --webroot-path="/home/miHome/FolderPagina" -d "midominio" > /home/miHome/logs/cerificado.log











0 comentarios :