Get $100 credit to create, test and run your vps on digitalOcean from here
Get Free SSL certificate for your website without any cost. For that, follow the steps.
You'll need to install snapd
sudo apt install snapd
For more instruction, click here
Execute the following instructions on the command line on the machine to ensure that you have the latest version of snapd.
sudo snap install core; sudo snap refresh core
If you have any Certbot packages installed using an OS package manager like apt, dnf, or yum, you should remove them before installing the Certbot snap to ensure that when you run the command certbot the snap is used rather than the installation from your OS package manager. Exact command is
sudo apt-get remove certbot, sudo dnf remove certbot
If you previously used Certbot through the certbot-auto script, you should also remove its installation by following the instructions here
Run this command on the command line on the machine to install Certbot.
sudo snap install --classic certbot
Execute the following instruction on the command line on the machine to ensure that the certbot command can be run. You will get error if the required file is already exists. otherwise it will prepare the certbot.
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Execute the below command.
sudo certbot --nginx
If you get any error like Could not choose appropriate plugin: The requested nginx plugin does not appear to be installed or something like that, then execute the below command and run again the above command
sudo apt-get install python3-certbot-nginx
The Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire. You will not need to run Certbot again, unless you change your configuration.
You can test automatic renewal for your certificates by running this command
sudo certbot renew --dry-run
If that command completes without errors, your certificates will renew automatically in the background.
To confirm that your site is set up properly, visit the site in your browser and look for the lock icon in the URL bar.