securing your website is essential for protecting user data and building trust. A Wildcard SSL certificate from Let's Encrypt allows you to secure your main domain and all its subdomains with a single certificate. This article guides you through the process of obtaining and installing a Wildcard SSL certificate from Let's Encrypt.
Prerequisites
- A registered domain name (e.g., example.com)
- Root or sudo access to your server
- Certbot installed on your server
- Access to DNS management for your domain
Step 1: Install Certbot
Certbot is a popular tool for obtaining SSL certificates from Let's Encrypt. To install Certbot, run the following commands based on your server's operating system.
For Ubuntu/Debian:
sudo apt update
sudo apt install certbot
For CentOS/RHEL:
sudo yum install epel-release
sudo yum install certbot
Step 2: Generate Wildcard Certificate
Obtaining a Wildcard SSL certificate requires DNS validation. Use the following command to request the certificate:
sudo certbot certonly --manual --preferred-challenges=dns --server https://acme-v02.api.letsencrypt.org/directory -d "*.example.com" -d "example.com"
Step 3: Verify DNS TXT Record
Certbot will prompt you to create a DNS TXT record to prove domain ownership. Log in to your DNS provider's dashboard and add the specified TXT record. It may take some time for DNS propagation.
Step 4: Complete the Validation
Once you've added the DNS TXT record, press Enter in the terminal to continue. Certbot will verify the record and generate your SSL certificate if validation is successful.
Step 5: Install the Certificate
After obtaining the certificate, you'll find the files in /etc/letsencrypt/archive/. Configure your web server to use these files.
For Nginx:
Update your server block to include:
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
Step 6: Automate Certificate Renewal
Let's Encrypt certificates are valid for 90 days. Set up a cron job to automatically renew your certificate:
sudo crontab -e
Add the following line:
0 0 * * * /usr/bin/certbot renew --quiet
Conclusion
Obtaining a Wildcard SSL certificate from Let's Encrypt enhances your website's security by covering all subdomains with a single certificate. Follow these steps carefully, and remember to keep your certificates renewed for ongoing protection.