How to install free SSL certificate?

June 13, 2024

Installing a free SSL certificate on your website is a great way to secure your site without incurring additional costs. One of the most popular providers of free SSL certificates is Let’s Encrypt. Below are the steps to install a Let’s Encrypt SSL certificate on a website hosted on a server with common environments such as Apache, Nginx, or using a control panel like cPanel.

Using Certbot with Apache or Nginx

Certbot is a free, open-source software tool for automatically using Let’s Encrypt certificates on manually-administered websites to enable HTTPS.

Prerequisites:

  • A registered domain name.
  • Access to your server’s terminal (SSH access).
  • A web server (Apache or Nginx) installed and running.

Steps for Installation:

  1. Update Your Package Lists:
    • Ensure your package lists are up-to-date.
    bashCopy codesudo apt-get update
  2. Install Certbot:
    • For Apache:bashCopy codesudo apt-get install certbot python3-certbot-apache
    • For Nginx:bashCopy codesudo apt-get install certbot python3-certbot-nginx
  3. Obtain the SSL Certificate:
    • For Apache:bashCopy codesudo certbot --apache
    • For Nginx:bashCopy codesudo certbot --nginx
  4. Follow the Prompts:
    • Certbot will prompt you to enter your email address and agree to the terms of service.
    • It will then ask for the domain names you want to activate HTTPS for (you can list multiple domains separated by commas).
  5. Automatic Renewal:
    • Certbot sets up a cron job or systemd timer to automatically renew the certificates before they expire.
    • You can test the automatic renewal process with:bashCopy codesudo certbot renew --dry-run

Using Let’s Encrypt with cPanel

If your hosting provider uses cPanel, the process is more straightforward:

  1. Log in to cPanel:
    • Access your cPanel account through your hosting provider.
  2. Navigate to SSL/TLS:
    • Look for the “SSL/TLS” section or “Security” section, then find “Let’s Encrypt SSL.”
  3. Install the SSL Certificate:
    • In the Let’s Encrypt interface, you can select the domain you want to secure.
    • Follow the prompts to install the SSL certificate. cPanel will handle most of the configuration for you.
  4. Verify Installation:
    • After installation, ensure the certificate is active by visiting your website using https:// and checking the security indicator in the browser.

Manual Installation Using CSR for free SSL(Certificate Signing Request)

If you need to manually install a free SSL certificate, such as from ZeroSSL or SSL For Free, you can generate a CSR and follow their process:

  1. Generate CSR:
    • You can generate a CSR and private key using OpenSSL:
    bashCopy codeopenssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
  2. Request the SSL Certificate:
    • Go to the website of a free SSL provider like ZeroSSL or SSL For Free.
    • Use the CSR to request a certificate.
  3. Download the Certificate Files:
    • Once the certificate is issued, download the necessary files, typically including the certificate file and the CA bundle.
  4. Install the Certificate:
    • Place the certificate files on your server.
    • For Apache, edit the virtual host file:apacheCopy code<VirtualHost *:443> ServerName yourdomain.com DocumentRoot /var/www/yourdomain SSLEngine on SSLCertificateFile /etc/ssl/certs/yourdomain.crt SSLCertificateKeyFile /etc/ssl/private/yourdomain.key SSLCertificateChainFile /etc/ssl/certs/chain.pem </VirtualHost>
    • For Nginx, edit the server block file:nginxCopy codeserver { listen 443 ssl; server_name yourdomain.com; ssl_certificate /etc/ssl/certs/yourdomain.crt; ssl_certificate_key /etc/ssl/private/yourdomain.key; ssl_trusted_certificate /etc/ssl/certs/chain.pem; location / { root /var/www/yourdomain; } }
  5. Restart the Web Server:
    • Restart Apache or Nginx to apply the changes:
    bashCopy codesudo systemctl restart apache2 bashCopy codesudo systemctl restart nginx

Conclusion

Using Let’s Encrypt with Certbot or cPanel provides an easy way to secure your website with a free SSL certificate. Regularly updating and renewing your SSL certificates is essential for maintaining security and ensuring uninterrupted HTTPS service. If you’re using a manual installation method, always keep your private key secure and follow best practices for managing certificates.