To enable SSL in Apache 2 on Ubuntu 20.10, you can follow these steps:
Install the Apache2 SSL module
sudo apt-get update
sudo apt-get install libssl-dev apache2-utils
sudo a2enmod ssl
Create a new SSL certificate and private key for your domain
Create a new SSL certificate and key pair for your domain. Make sure you change the your_domain.key to your own domain name; whilst it won't really make a difference, if you're securing a number of different domains it makes sense to create the keys with the domain they match as it can often be confusing when copying keys around servers if they're all named by default names!
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/your_domain.key -out /etc/ssl/certs/your_domain.crt
Configure a virtual host for your domain in Apache
sudo nano /etc/apache2/sites-available/your_domain.conf
ServerAdmin admin@your_domain.com
ServerName your_domain.com
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/your_domain.crt
SSLCertificateKeyFile /etc/ssl/private/your_domain.key
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Discussion