How to install free SSL Certificate for your website using Let's Encrypt

SSL Certification

Secure websites use encryption and authentication standards to protect the confidentiality of web transactions. Hypertext Transfer Protocol Secure is an extension of the Hypertext Transfer Protocol. It is used for secure communication over a computer network and is widely used on the Internet. In HTTPS, the communication protocol is encrypted using Transport Layer Security or, formerly, Secure Sockets Layer.

Step 1: Installation Of Apache

Use the following command to install Apache.

yum install httpd -y

After the installation, we can add service in the firewall using firewall-cmd.

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https

Then we can reload the firewalld service.

firewall-cmd --reload

Start and Enable the Apache.

systemctl start httpd
systemctl enable httpd

Check the status of Apache

systemctl status httpd

When you have your server’s IP address or Domain name and enter it into your browser’s address bar.

Step 2: Create A Sample Website

Create the HTML directory for as follows, using the -p flag to create any necessary parent directories.

mkdir -p /var/www/

Create an additional directory to store log files for the site.

mkdir -p /var/www/

Next, Create a sample

vi /var/www/

Press i and add the following sample HTML to the file and save.

    <title>Welcome to!</title>
    <h1>Success! The virtual host is working!</h1>

Create directory for sites-available and sites-enabled.

mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled


vi /etc/httpd/conf/httpd.conf

Add this line to the end of the file.

IncludeOptional sites-enabled/*.conf

Add following lines to this file.

vi /etc/httpd/sites-available/

<VirtualHost *:80>
    DocumentRoot /var/www/
    ErrorLog /var/www/
    CustomLog /var/www/ combined

Finally create a symbolic link.

ln -s /etc/httpd/sites-available/ /etc/httpd/sites-enabled/

Step 3: Free SSL Certificate

Go to certbot home page

Select Apache and CentOs7.

Enable EPEL repo and install Certbot.

yum install certbot python2-certbot-apache

Run this command to get a certificate and have Certbot edit your Apache configuration automatically to serve it, turning on HTTPS access in a single step.

certbot --apache

Allow everything and put your domain name also.

Add a cron job to the default crontab.

echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew -q" | sudo tee -a /etc/crontab > /dev/null

Confirm that Certbot worked.

Our sample website name.


We hope this article helped you learn how to get a free SSL certificate for your website. SSL, more commonly called TLS, is a protocol for encrypting Internet traffic and verifying server identity. TheStack is one of the best web hosting providers that offer premium shared web hosting, cheap dedicated server hosting, VPS server, WordPress hosting, and free SSL certificates. Be assured with our services and reach out to our team of experts to know more.

Related Articles