Setup LetsEncrypt on Debian

Install LetsEncrypt Client
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
Obtain a Certificate
  • Inside the nginx config, add this location block:
location ~ /\.well-known/acme-challenge {
    root /var/www/html;
}
  • Reload Nginx:
systemctl reload nginx
  • Generate Certificate:
cd /opt/letsencrypt
./letsencrypt-auto certonly -a webroot \
    --webroot-path=/var/www/html \
    -d example.com \
    -d www.example.com