What is the proper way to edit /etc/apache2/sites-enabled
when there is example.com.conf
and example.com-le-ssl.conf
?
Should I edit both the files when changing something? Or only one and then somehow force certbot-auto
to fix it?
Apache2letsencryptssl
What is the proper way to edit /etc/apache2/sites-enabled
when there is example.com.conf
and example.com-le-ssl.conf
?
Should I edit both the files when changing something? Or only one and then somehow force certbot-auto
to fix it?
Best Answer
I'm not sure what is the right answer of your question, but I would suggest you the following simplification:
1. Force all users to use HTTPS. The definition of the HTTP VirtualHost should look like this:
In this way you will need maintain only the configuration of the HTTPS VirtualHost.
2. As soon as you generate "Let's Encrypt" ssl certificate files, describe them manually into the definition of the HTTPS VirtualHost:
3. Insert the definitions of both VirtualHosts into a single configuration file:
This file could be
/etc/apache2/sites-available/example.com.conf
.4. Don't forget to
a2dissite
unnecessary VirtualHosts (respectivelya2ensite
the necessary ones) and restart Apache.5. Edit root's crontab and add a job which will try to renew the certificates, every week, for example. Type
sudo crontab -e
and add this line at the bottom:That's it.