How to Install an SSL Certificate on a Domain ⋆ ALexHost SRL

Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills
10.10.2024

How to Install an SSL Certificate on a Domain

How to Install an SSL Certificate on a Domain

An SSL (Secure Sockets Layer) certificate is essential for securing communication between a website and its users by encrypting data transmitted over the internet. It helps build trust by ensuring that sensitive information, such as login credentials, payment details, and personal data, is protected. SSL certificates are also a key factor for SEO, as search engines like Google prioritize websites with HTTPS over HTTP.

Prerequisites

Before you begin the SSL certificate installation, ensure you have the following:

  • A Domain: You need a registered domain name where the SSL certificate will be installed.
  • SSL Certificate: You can obtain an SSL certificate from a Certificate Authority (CA) such as Let’s Encrypt (free), Comodo, DigiCert, or others. The SSL certificate usually includes a certificate.crt file and sometimes an intermediate certificate or bundle file (ca_bundle.crt).
  • Web Hosting Access: You need access to your web hosting control panel (e.g., cPanel, Plesk) or root access to the server if you’re managing the server via SSH.

Step-by-Step Guide to Installing an SSL Certificate

Method 1: Installing an SSL Certificate Using cPanel

Most web hosting providers use cPanel as a control panel, making it easy to install an SSL certificate through a graphical interface.

  1. Log in to cPanel: Navigate to your cPanel login page (usually https://yourdomain.com:2083) and log in with your credentials.
  2. Navigate to SSL/TLS: In the cPanel dashboard, look for the SSL/TLS icon under the Security section.
  3. Manage SSL Sites: Click on Manage SSL Sites under the Install and Manage SSL for your site (HTTPS) section.
  4. Select Your Domain: Use the dropdown menu to select the domain for which you want to install the SSL certificate.
  5. Copy and Paste Certificate Files:
    • Certificate (CRT): Open your certificate.crt file in a text editor and copy its contents. Paste it into the Certificate (CRT) field in cPanel.
    • Private Key (KEY): If you generated the private key when creating the certificate signing request (CSR) in cPanel, it should automatically populate. If not, paste the private key into the Private Key (KEY) field.
    • Certificate Authority Bundle (CA Bundle): If your SSL provider gave you a ca_bundle.crt file, copy its contents and paste them into the CABUNDLE field.
  6. Click Install Certificate: After filling in all the fields, click the Install Certificate button. cPanel will validate and install the SSL certificate for your domain.
  7. Verify Installation: Visit your website using https://yourdomain.com to ensure that the SSL certificate is properly installed. Look for the padlock icon in the browser address bar to confirm that the SSL is active.

Method 2: Installing an SSL Certificate Using Let’s Encrypt

Let’s Encrypt provides free SSL certificates that can be installed on your server using tools like Certbot. Here’s how to use Certbot for a Let’s Encrypt SSL certificate installation:

  1. Log in to Your Server: Use SSH to connect to your server. For example:
    ssh username@yourserver.com
  2. Install Certbot: Certbot is a popular tool for automating the installation of Let’s Encrypt SSL certificates. Install Certbot with the following commands (for Debian/Ubuntu):
    sudo apt update
    sudo apt install certbot python3-certbot-apache

    For Nginx, use:

    sudo apt install certbot python3-certbot-nginx
  3. Obtain and Install the SSL Certificate:
    • For Apache:
      sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
    • For Nginx:
      sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
  4. Follow the Prompts: Certbot will ask you to choose options for redirecting HTTP traffic to HTTPS. It’s recommended to select the option that automatically redirects all HTTP traffic to HTTPS for better security.
  5. Verify the Installation: Once the installation is complete, Certbot will automatically configure your web server to use the new SSL certificate. Visit https://yourdomain.com in your web browser to confirm that the SSL certificate is active.
  6. Set Up Auto-Renewal: Let’s Encrypt certificates expire every 90 days, but Certbot includes automatic renewal functionality. You can test the renewal process with:
    sudo certbot renew --dry-run

Method 3: Manual Installation via SSH

If you don’t have access to cPanel or want more control over the installation, you can manually install an SSL certificate on your server using SSH.

  1. Upload Certificate Files to the Server: Use an SFTP client like FileZilla or the scp command to upload the certificate.crt, private.key, and ca_bundle.crt files to your server.
  2. Configure Apache or Nginx:
    • For Apache, edit the virtual host file for your domain:
      sudo nano /etc/apache2/sites-available/yourdomain.com.conf

      Add the following lines:

      <VirtualHost *:443>
      ServerName yourdomain.com
      SSLEngine on
      SSLCertificateFile /path/to/certificate.crt
      SSLCertificateKeyFile /path/to/private.key
      SSLCertificateChainFile /path/to/ca_bundle.crt
      </VirtualHost>

      Save and close the file, then restart Apache:

      sudo systemctl restart apache2
    • For Nginx, edit your domain’s server block:
      sudo nano /etc/nginx/sites-available/yourdomain.com

      Add the following lines within the server block:

      server {
      listen 443 ssl;
      server_name yourdomain.com;
      ssl_certificate /path/to/certificate.crt;
      ssl_certificate_key /path/to/private.key;
      ssl_trusted_certificate /path/to/ca_bundle.crt;
      }

      Save and close the file, then restart Nginx:

      sudo systemctl restart nginx
  3. Verify SSL Installation: Visit https://yourdomain.com in your browser to ensure that the SSL certificate is correctly installed.

Testing and Verifying SSL Installation

After installing your SSL certificate, it’s essential to verify that everything is working correctly:

  • SSL Checker Tools: Use online SSL checker tools like SSL Labs to test your SSL certificate and ensure it’s properly configured.
  • Browser Test: Visit your website using https:// and check for a padlock icon or “Secure” label in the browser address bar.
  • Check for Mixed Content: Ensure that all assets (images, scripts, styles) are loaded over HTTPS to avoid mixed content warnings, which can prevent your site from being fully secure.

Conclusion

Installing an SSL certificate on your domain is a crucial step in securing your website and protecting user data. By following the methods outlined in this guide—whether through cPanel, Let’s Encrypt, or manual installation—you can easily secure your website with HTTPS. Remember to verify the installation and set up automatic renewal if using Let’s Encrypt to maintain continuous security. With a properly installed SSL certificate, you can provide a safer and more trustworthy experience for your website’s visitors.

Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills