How to setup free ssl in apache ?

Ujjwal Thakur

I am a FullStack Engineer, having 6+ years of experience, mostly worked in React.JS, TypeScript, JavaScript, JQuery, Laravel (PHP), MVC Arcticture, MySqli, Redis, REST APIs etc..

Having good knowledge of JIRA, AWS Cognito, S3 Bucket, EC2 Instances, Elastic IP, Bitbucket, Git, CICD Pipelines, Linux etc..

Latest Posts



Archive


 You can set up a free SSL certificate from Let’s Encrypt to use with Apache by following these steps:

  1. Install Certbot:

    sql
    sudo apt-get update sudo apt-get install certbot
  2. Obtain a certificate:

    css
    sudo certbot certonly --webroot --webroot-path /var/www/html -d example.com

    Replace example.com with your own domain name.

  3. Update Apache virtual host:

    bash
    sudo nano /etc/apache2/sites-available/example.com.conf

    Add the following lines inside the VirtualHost block:

    bash
    SSLEngine on SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem

    Save and exit the file.

  4. Test Apache configuration:

    sudo apachectl configtest

    If the output is “Syntax OK,” restart Apache:

    sudo systemctl restart apache2

Your Apache server should now be configured to use the Let’s Encrypt SSL certificate. You can test it by visiting https://example.com in a web browser.

Leave a Reply

Your email address will not be published. Required fields are marked *