How to install free SSL Certificate for your website using Let's Encrypt
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.
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
test.com as follows, using the -p flag to create any necessary parent directories.
mkdir -p /var/www/test.com/html
Create an additional directory to store log files for the site.
mkdir -p /var/www/test.com/log
Next, Create a sample
Press i and add the following sample HTML to the file and save.
<html> <head> <title>Welcome to test.com!</title> </head> <body> <h1>Success! The test.com virtual host is working!</h1> </body> </html>
Create directory for sites-available and sites-enabled.
mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled
Add this line to the end of the file.
Add following lines to this file.
<VirtualHost *:80> ServerName www.test.ninjasail.com ServerAlias test.ninjasail.com DocumentRoot /var/www/test.com/html ErrorLog /var/www/test.com/log/error.log CustomLog /var/www/test.com/log/requests.log combined </VirtualHost>
Finally create a symbolic link.
ln -s /etc/httpd/sites-available/example.com.conf /etc/httpd/sites-enabled/example.com.conf
Step 3: Free SSL Certificate
Go to certbot home page https://certbot.eff.org/
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.
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.