Computers & Electronics
7,640 views
25 min · 3 min read
7 steps
Advanced

How to implement HTTPS on a personal site using Let's Encrypt and auto‑renewal scripts

Securing your personal website with HTTPS is easier than it sounds and gives visitors privacy and trust. This guide walks through setting up free TLS certificates from Let’s Encrypt and automating renewals so you can forget about expiration. Expect to spend about 20–60 minutes for initial setup and a few minutes for testing.

Verified by pleasexplain editors
  1. Step 1: Confirm domain and server access

    Ensure you control the domain name and can SSH into the server or access DNS records. You will need either shell access to install software (about 10–15 minutes) or the ability to create a DNS TXT or HTTP file for validation. Knowing your web root path (e.g., /var/www/site) speeds things up.

    [Illustration: laptop terminal showing SSH connection to a server with domain name on screen]

  2. Step 2: Install Certbot or ACME client

    Install the official Certbot or an ACME-compatible client for your OS: use apt install certbot on Debian/Ubuntu, yum install certbot on CentOS, or brew install certbot on macOS. If using a web host panel, check for a built-in Let's Encrypt option to avoid manual installation. This step typically takes 2–5 minutes.

    [Illustration: command line installing certbot package with progress lines]

  3. Step 3: Obtain a certificate interactively

    Run certbot with the appropriate plugin: for a webroot setup use certbot certonly --webroot -w /var/www/site -d example.com -d www.example.com. For automatic server integration try certbot --apache or --nginx. Expect the ACME validation to complete within 30–60 seconds per domain.

    [Illustration: terminal showing certbot successfully obtaining certificates with domain names listed]

  4. Step 4: Configure your web server to use TLS

    Point your web server to the issued certificate files, typically in /etc/letsencrypt/live/example.com/fullchain.pem and privkey.pem. Update your nginx or Apache virtual host to listen on port 443 and enable strong ciphers and TLS versions (e.g., TLS 1.2 and 1.3). Restart the server and test with curl -I https://example.com.

    [Illustration: configuration file with server block for HTTPS and reload command output]

  5. Step 5: Set up a renewal test run

    Run sudo certbot renew --dry-run to verify automatic renewal works without changing live certs. The dry-run uses the Let’s Encrypt staging environment and should complete successfully within a minute or two; any failures here must be resolved before automating.

    [Illustration: terminal showing certbot renew dry-run success messages and timestamps]

  6. Step 6: Create an auto-renewal cron or systemd timer

    Automate renewals by adding a cron job that runs twice daily, for example: 0 3,15 * * * /usr/bin/certbot renew --quiet --deploy-hook "/usr/sbin/service nginx reload". Alternatively create a systemd timer to run certbot renew every 12 hours. Renewals are attempted only when certs are within 30 days of expiry.

    [Illustration: crontab entry displayed in editor and systemd timer unit file excerpt]

  7. Step 7: Monitor and verify after renewal

    After automation is enabled, check logs in /var/log/letsencrypt/ and set an alert to email you on renewal failure. Manually verify the certificate expiry with openssl x509 -in /etc/letsencrypt/live/example.com/cert.pem -noout -enddate every month; expected renewal will push the date forward by 90 days.

    [Illustration: monitoring dashboard showing certificate expiry dates and a log file open]


  • Use webroot validation when you cannot open port 80; it needs only a small file in your site directory.
  • If behind a CDN, enable “full (strict)” TLS and install the origin certificate on your server when supported.
  • Keep Certbot updated; security fixes and new ACME features land every few months. Run apt update && apt upgrade monthly.
  • Use strong Diffie-Hellman parameters (e.g., 2048-bit or higher) and prefer TLS 1.3 when possible for performance and security.
  • Store a recovery SSH key and document the renewal cron command in a README to avoid lockout if you revisit months later.
  • Test from external networks and browsers (Chrome, Firefox) after setup and after each renewal to catch mixed-content issues early.

  • Never share your private key files (privkey.pem); restrict permissions to root and limit backups.
  • Do not run certbot renew too frequently; default 12-hour checks are fine—excessive calls can hit rate limits.
  • If you use the Let’s Encrypt production CA, be mindful of rate limits: avoid mass-renewing many domains in short timeframes.
  • When using HTTP validation, ensure port 80 is reachable and not redirected incorrectly, or issuance will fail.

Was this guide helpful?