IT TUTORIAL 

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

Apache2.0

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/yourweb.com.conf

input:

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

/etc/init.d/apache2 restart


3. Upload your website files to server folder:

/var/www/html/yourweb.com/


4. Make virtual host enabled

ln -s /etc/apache2/sites-available/yourweb.com.conf  /etc/apache2/sites-enabled/yourweb.com.conf


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 yourweb.com must already point to the local IP, otherwise certbot will fails to run.


7. Run certbot script

certbot --apache -d yourweb.com -d www.yourweb.com
/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 https://www.yourweb.com, the browser will to display the security notice:


-End-

Categories