Background I have a simple server with only one site. I want to force ssl. I previously did this with a self signed certificate, but now I have got a letsencrypt cert. I have used the auto set up, but when I access my site it uses the old certificate.

I think my question is similar to: default apache index.html shows up even though i have a sites-enabled file

In this answer: https://serverfault.com/a/690668/226403 one of the options is "If you want this as your default/only host, then don't even bother with VirtualHost tags, and apply your configuration at the server level".

Question How do I change the server wide configuration? I think this server wide configuration is what is using the old certificate, but I cannot fathom how to change it?

Thanks! (My set-up is a Ubuntu VM using apache)

Edit: In /etc/apache2/ssl there are old .key and .pem files, if I move these everything breaks horribly and apache won't start!

Solution (For me at least). Apparently you can set things up in sites-available and in conf-available. Lets Encrypt automatically sets up sites-available for you, but not conf-available. I performed a recursive search (using https://stackoverflow.com/questions/16956810/finding-all-files-containing-a-text-string-on-linux): $ grep -rnw '/etc/apache2/' -e 'SSLCertificateFile'. Found the incorrect files in conf-available and rebooted apache: sudo service apache2 reload.


If you have an existing, working https configuration in /etc/apache2/ssl you should only need to change the values for the relevant configuration files to point to the new files supplied by letsencrypt.

For example, example.com files would be stored in


The configuration settings you need to change are

SSLCertificateFile      /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile   /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/fullchain.pem

save the file and restart apache2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.