How to make your website https for free

by admin on 2018-09-18 19:12:48

Some browsers such as chrome, will display "not secure" notice when user visit http website. 

This tutorial teaches you how to install a free HTTPS certificate for your website.

Required environment:

Operating SystemWeb ServerCertificate

Ubuntu 16 LTS or above


Let’s Encrypt

Installation steps:

1. Install apache

apt update
apt install apache2

2. Add your virtual host in apache

vi /etc/apache2/sites-available/


<virtualhost *:80="">
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/
        <directory var="" www="" html="""">
                Options FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

/etc/init.d/apache2 restart

3. Upload your website files to server folder:


4. Make virtual host enabled

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

5. Turn on the SSL module

a2enmod ssl
/etc/init.d/apache2 restart

6. Install certbot

apt-get update
apt-get install software-properties-common
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install python-certbot-apache 

 Note: Before installing certbot, your domain name must already point to the local IP, otherwise certbot will fails to run.

7. Run certbot script

certbot --apache -d -d
/etc/init.d/apache2 restart

8. Let the https certificate update automatically

crontab -e 

add a line:

43 6 * * * /usr/bin/certbot renew --post-hook "/etc/init.d/apache2 restart"

Once you're done, open your browser and go to, the browser will to display the security notice: