Security and SSL
Enable HTTPS in Moodle
First check that the domain presents a valid certificate over HTTPS and make a copy of config.php and the database. AutoSSL can only cover eligible names that pass its validation.
To configure the secure address, find and edit the config.php file in the directory where you installed Moodle.
Once inside, find the following line, which contains the app's address:
$CFG->wwwroot = 'http://example.com';
Replace http with https:
$CFG->wwwroot = 'https://example.com';
If Moodle is behind a proxy that terminates TLS, set $CFG->sslproxy only after confirming that architecture; enabling it without a proxy can be insecure or cause errors. Then force the HTTP to HTTPS redirect on the server, run Moodle's HTTPS conversion tool to find embedded content and test access, login, tasks, SCORM, LTI, images and iframe elements.
If the installation lives in a subdirectory, keep that path: for example, https://example.com/campus. Do not run a global replacement of every http string in the database.
The conversion tool is under Site administration > Security > HTTP security > HTTPS conversion tool. Use it first to identify incompatible resources and review its scope before confirming changes. Keep the database backup so that you can go back to the previous state. Moodle documentation.
You may also find useful
- AutoSSL notice: the renewal may reduce coverage Explains the reduction of coverage notice, how to find the domain that fails validation and when to...
- Automatic SSL certificates for domains and subdomains Check AutoSSL's free coverage and enable HTTPS on your website once the certificate is valid.
- Diagnose an invalid SSL certificate Tell apart a wrong name, expiry and the chain of trust; check the DNS destination and the AutoSSL st...
- Enable HTTPS in WordPress with a valid SSL certificate Switch WordPress from HTTP to HTTPS while keeping its domain and paths, and check login, redirects a...
Something wrong or out of date? Tell us and we will review it.