Faruque Ahmed : MCP, MCSA, MCSE, MCTS, MCIT, CCNA, OCA, OCP, GCP
apt install apache2
systemctl status apache2.service
systemctl enable apache2.service
systemctl start apache2.service
ufw allow proto tcp to 0.0.0.0/0 port 80
ufw allow proto tcp to 0.0.0.0/0 port 443
nstalling Certbot
Follow the instructions on the official website to install it. The steps are roughly as follows: [3]
First, update your snapd version to the latest version.
snap install core; sudo snap refresh core
Next, install Certbot.
snap install --classic certbot
Finally, add the symbolic link.
ln -s /snap/bin/certbot /usr/bin/certbot
Now that the installation of Certbot is complete, we will issue and install a certificate.
Issuing and Installing a Certificate
To issue and install the certificate, simply run the following command: [4]
certbot certonly --apache
When you run it, you will be prompted to enter the following information, so enter it appropriately.
Your email address
Whether to receive notification emails
The domain name for which you want to issue the certificate ( sv1.example.com e.g.
If you want to support multiple domain names, sv1.example.com, www.example.com, example.com just enter them separated by commas.
The certificate will be installed in /etc/letsencrypt/live/sv1.example.com/fullchain.pem and the corresponding private key in. /etc/letsencrypt/live/sv1.example.com/privkey.pem
Let's set up HTTPS. First, disable the default site configuration file.
a2dissite 000-default.conf
Next, create a site configuration file.
cd /etc/apache2/sites-available/
vim mysite.conf
vim mysite-ssl.conf
Here is an example with mysite.confa site configuration file :mysite-ssl.conf
# vi /etc/apache2/sites-available/mysite.conf
Finally, enable the module and site configuration files and restart the service.
a2enmod ssl
a2ensite mysite.conf
a2ensite mysite-ssl.conf
systemctl restart apache2.service
Try accessing the site again as shown below
https://sv1.example.com