How to install SSL in Ubuntu 20.04

 

This article is for people who are looking to set up SSL in ubuntu 20. The SSL protocol encrypts the traffic between a browser and server, preventing third parties from eavesdropping on sensitive information. This guide will show you how to set up SSL in ubuntu 20 without any hassle.

First Try to buy Ubuntu server from any server provider. select ubuntu os 18.04 or 20.04

 

First You need install apach2 must be then try install others..

Then we need to install Apache 2 and PHP 8

Table of Contents

Install Apache 2 and PHP 8

 

Update the apt using the following command.

sudo apt-get update

When your APT is updated then add this apt repository which holds PHP installing .deb packages.

sudo add-apt-repository ppa:ondrej/php

So now as we set the repository for the php8, please run the below command to install PHP8

sudo apt-get install php8.0 -y

 

Next, reboot the apache server.

sudo systemctl restart apache2

Set apache to restart automatically when the system reboots.

sudo systemctl enable apache2

 

Create a VirtualHost:

 

After setting up the Apache 2 server, then you need to create a virtual host to map your domain with the server. An example of a virtual host configuration is given below.

sudo cd /etc/apache2/sites-available/000-default.conf

 

or go folder /etc/apache2/site-availabe

create a file name  000-default.conf

000-default.conf

then edit the file

 

<VirtualHost *:80>

# REQUIRED. Set this to the host/domain/subdomain that
# you want this VirtualHost record to handle.

ServerName a2zvpn.com

# Optional. You can specify additional host names that
# serve up the same site. This can be top-level, domains,
# sub-domains, and can even use wildcard subdomains such
# as *.yourdomain.com – just separate each host name
# with a single space.

ServerAlias www.a2zvpn.com

# REQUIRED. Set this to the directory you want to use for
# this vhost site’s files.

DocumentRoot /var/www/html

# Optional. Uncomment this and set it to your admin email
# address, if you have one. If there is a server error,
# this is the address that Apache will show to users.

ServerAdmin [email protected]

# Optional. Uncomment this if you want to specify
# a different error log file than the default. You will
# need to create the error file first.

#ErrorLog /var/www/html/logs/error_log

# REQUIRED. Let’s make sure that .htaccess files work on
# this site. Don’t forget to change the file path to
# match your DocumentRoot setting above.

<Directory /var/www/>
AllowOverride All
</Directory>

RewriteEngine on
RewriteCond %{SERVER_NAME} =a2zvpn.com [OR]
RewriteCond %{SERVER_NAME} =a2zvpn.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

 

Copy the example configuration and change the domain name to yours.

 

Add the confirmation text for your domain name over there.

Now copy the IP address of your server and set the A record. Wait 5-10 mins for DNS propagation.

 

Install Certbot

Once you have completed the setup of Apache 2, then you need to install Certbot.

In Ubuntu, Snapd is already installed. So you don’t need to do anything here. But for other OS, you need to first install SNAPD.

Then run the following command to install “core”

sudo apt install snapd


sudo snap install core

Next, install the certbot using the following command.

sudo snap install --classic certbot

Once you have installed the certbot then it’s time to issue the SSL certificate by running the following command.

sudo certbot --apache

This will issue an SSL certificate for you using Letsencrypt and will make the necessary changes in the “.conf” file.

How to install SSL in Ubuntu 20.04
0 0 6 4 2 4
Your IP Address : 3.239.3.196
We Accept Bkash DBBL Paypal Neteller PerfectMoney Skrill