docs / https / certbot-ssl-reinstall

certbot SSL (re)install

https updated 2025-06-20
textcopy
sudo certbot certonly --manual --preferred-challenges dns -d '*.example.com' --agree-tos --email your_email@example.com --server https://acme-v02.api.letsencrypt.org/directory

with the result :

  • Certificate is saved at: /etc/letsencrypt/live/domain.name/fullchain.pem
  • Key is saved at: /etc/letsencrypt/live/domain.name/privkey.pem

THEN:

nano /etc/apache2/sites-available/default-ssl.conf

textcopy
<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost

                DocumentRoot /var/www/html

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

                SSLEngine on

                SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
                SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

        </VirtualHost>
</IfModule>
textcopy
sudo ufw allow 'Apache Full'
sudo ufw delete allow 'Apache'

sudo a2enmod ssl sudo a2enmod headers

sudo a2ensite default-ssl

sudo apache2ctl configtest

sudo systemctl restart apache2