Install SSL on Apache.
Enable TLS for an Apache virtual host with the appropriate certificate chain.
Before you begin: use an issued production certificate and its matching private key. Back up the current configuration. Staging certificates are not publicly trusted.
1Store the files securely
Place the key and certificate files in a restricted server directory. On Debian/Ubuntu, enable mod_ssl with a2enmod ssl; other distributions package it differently.
sudo install -d -m 700 /etc/apache2/ssl/example.com
sudo install -m 600 privkey.pem /etc/apache2/ssl/example.com/privkey.pem
sudo install -m 644 fullchain.pem /etc/apache2/ssl/example.com/fullchain.pem
sudo a2enmod ssl2Update your virtual host
Apache 2.4.8 and newer accepts the full chain in SSLCertificateFile. On older versions, use cert.pem there and specify chain.pem with SSLCertificateChainFile. Retain your existing document root and access rules.
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/example.com/fullchain.pem
SSLCertificateKeyFile /etc/apache2/ssl/example.com/privkey.pem
SSLProtocol -all +TLSv1.2 +TLSv1.3
</VirtualHost>3Validate and reload
Ensure the virtual host is enabled and Apache listens on 443. Service names may be httpd on Red Hat-based distributions.
sudo apachectl configtest && sudo systemctl reload apache2Confirm the connection.
Check the installed certificate and chain, then keep an eye on the expiry date.
Open SSL Checker