create an SSL certificate with Let’s Encrypt (ubuntu 20.04)

configure apache

$ cat /etc/apache2/sites-available/010-texla.cl.conf
<VirtualHost *:80>
    ServerAdmin admin@texla.cl
    ServerName texla.cl
    ServerAlias www.texla.cl
    DocumentRoot /var/www/texla.cl

    <Directory /var/www/texla.cl/>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.texla.cl.log
    CustomLog ${APACHE_LOG_DIR}/access.texla.cl.log combined

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

enable site

$ sudo a2ensite 010-texla.cl.conf
$ sudo systemctl reload apache2

create SSL certificate

$ sudo apt install certbot python-certbot-apache
$ sudo certbot --apache -d texla.cl -d www.texla.cl

answer to question

1: No redirect - Make no further changes to the webserver configuration.

restart Apache

$ sudo systemctl restart apache2

Scroll to Top