-
Login to moodle, navigate to
Site administration > Security > HTTP security > HTTPS conversion tool.and run it. -
Then on your server, edit
config.php:
nano /var/www/html/moodle/config.phpand change $CFG->wwwroot = 'http://XXXXXX.com'; to $CFG->wwwroot = 'https://XXXXXX.com';
- Set up LetsEncrypt with Apache2, activate HTTP-to-HTTPS redirect. (e.g. https://certbot.eff.org/lets-encrypt/ubuntuxenial-apache.html)
Done :-)